[projects/rc-scripts] daemon ssd mode: always setsid, so programs that properly don't daemonize get detached from terminal
glen
glen at pld-linux.org
Sun Mar 2 11:06:41 CET 2014
commit 9ecaca50bfd26e55c7bae36b9c412c05e182cfdb
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sun Mar 2 10:05:39 2014 +0000
daemon ssd mode: always setsid, so programs that properly don't daemonize get detached from terminal
there will be probably more programs that don't daemonie themselves due
that systemd movement which does all that for programs themselves
lib/functions | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/lib/functions b/lib/functions
index de386b9..aee3cc1 100644
--- a/lib/functions
+++ b/lib/functions
@@ -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} \
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/9ecaca50bfd26e55c7bae36b9c412c05e182cfdb
More information about the pld-cvs-commit
mailing list