if [ "$closefds" = 1 ]; then
exec 1>&-
exec 2>&-
- exec 0>&-
+ exec 0<&-
elif [ "$redirfds" = 1 ]; then
exec 1>/dev/null
exec 2>/dev/null
- exec 0>/dev/null
+ exec 0</dev/null
else
exec 2>&1
+ exec 0</dev/null
fi
if is_no "$RC_LOGGING"; then
done
IFS=$o
fi
+ set -- "$prog" "$@"
+
+ # use setsid to detach from terminal,
+ # needs pidfile or ssd would check setsid program instead of real program
+ if [ "$pidfile" ]; then
+ set -- /usr/bin/setsid "$@"
+ fi
+
/sbin/start-stop-daemon -q --start \
--nicelevel $nice \
${pidfile:+--pidfile $pidfile} \
${fork:+--background} \
${waitname:+--name $waitname} \
${SERVICE_DROPCAPS:+--dropcap $SERVICE_DROPCAPS} \
- --exec "$prog" \
- -- ${1:+"$@"}
+ --exec "$1" \
+ -- "$@"
else
nice -n $nice initlog -c "$prog" 2>&1 </dev/null
fi