From 9ecaca50bfd26e55c7bae36b9c412c05e182cfdb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 2 Mar 2014 10:05:39 +0000 Subject: [PATCH] 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 de386b98..aee3cc1f 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} \ -- 2.44.0