]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
fix RC_LOGGING=no daemon --makepid --fork write proper pidfile
authorElan Ruusamäe <glen@delfi.ee>
Fri, 9 Sep 2016 21:22:34 +0000 (00:22 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Fri, 9 Sep 2016 21:22:51 +0000 (00:22 +0300)
NOTE: setsid needs to be "outer" program
otherwise start-stop-daemon would capture the setsid pid not the actual program

as for RC_LOGGING=yes, this was already executed in this order:
setsid makepid program arguments

lib/functions

index 2b2e3a1d637d9ab04dd12a2d755dcdfe307e32d2..74f4c95a2f6f6b3e33e6f170d07cfe2fdd2644cf 100644 (file)
@@ -673,12 +673,11 @@ _daemon_exec() {
                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
+               # NOTE: setsid needs to be "outer" program
+               # otherwise start-stop-daemon would capture the setsid pid not the actual program
 
                prog=$1; shift
+               /usr/bin/setsid \
                /sbin/start-stop-daemon -q --start \
                        --nicelevel $nice \
                        ${pidfile:+--pidfile $pidfile} \
This page took 0.416852 seconds and 4 git commands to generate.