[projects/rc-scripts] fix RC_LOGGING=no daemon --makepid --fork write proper pidfile
glen
glen at pld-linux.org
Fri Sep 9 23:24:31 CEST 2016
commit b402dd3f91a54c34d9eaf99bee8e4a129286c749
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Sep 10 00:22:34 2016 +0300
fix RC_LOGGING=no daemon --makepid --fork write proper pidfile
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 | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/lib/functions b/lib/functions
index 2b2e3a1..74f4c95 100644
--- a/lib/functions
+++ b/lib/functions
@@ -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} \
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/b402dd3f91a54c34d9eaf99bee8e4a129286c749
More information about the pld-cvs-commit
mailing list