I've a patch to rc-scripts to add a --fork to daemon():

        daemon --fork /usr/sbin/daemon -args

for daemons that don't fork themselves.

Ari
Index: functions
===================================================================
RCS file: /cvsroot/rc-scripts/rc.d/init.d/functions,v
retrieving revision 1.80
diff -u -r1.80 functions
--- functions   9 Sep 2003 22:45:49 -0000       1.80
+++ functions   24 Mar 2004 01:34:45 -0000
@@ -273,7 +273,7 @@
        while [ "$1" != "${1##-}" ] || [ "$1" != "${1##+}" ]; do
                case $1 in
                  '')
-                       msg_usage " daemon [--user user] [+/-nicelevel] {program}"
+                       msg_usage " daemon [--user user] [--fork] [+/-nicelevel] 
{program}"
                        return 2
                        ;;
                  --check)
@@ -287,6 +287,11 @@
                        [ "$1" != "root" ] && prog="/bin/su $1 -c \""
                        shift
                        ;;
+        --fork)
+         prog="/usr/bin/setsid sh -c \""
+         end='&'
+         shift
+         ;;
                  -*|+*) SERVICE_RUN_NICE_LEVEL=$1
                        shift;;
                esac
@@ -294,9 +299,9 @@
        # If command to execute ends with quotation mark, add remaining
        # arguments and close quotation.
        if [ "$prog" != "${prog%\"}" ]; then
-               prog="$prog $*\""
+               prog="$prog $*$end\""
        else
-               prog="$prog $*"
+               prog="$prog $*$end"
        fi
 
        # make sure it doesn't core dump anywhere; while this could mask

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to