]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
daemon ssd mode: always setsid, so programs that properly don't daemonize get detache...
authorElan Ruusamäe <glen@delfi.ee>
Sun, 2 Mar 2014 10:05:39 +0000 (10:05 +0000)
committerElan Ruusamäe <glen@delfi.ee>
Sun, 2 Mar 2014 10:05:43 +0000 (10:05 +0000)
there will be probably more programs that don't daemonie themselves due
that systemd movement which does all that for programs themselves

lib/functions

index de386b98037551cd77f6252228396256bc340cec..aee3cc1fff66dddf06e08dbcd3f12c5690132895 100644 (file)
@@ -752,6 +752,12 @@ daemon() {
                        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} \
This page took 0.391942 seconds and 4 git commands to generate.