rc-scripts daemon --fork
Aredridel
aredridel at nbtsc.org
Wed Mar 24 02:48:32 CET 2004
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
-------------- next part --------------
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </mailman/pipermail/pld-devel-en/attachments/20040323/ccaf4b47/attachment.sig>
More information about the pld-devel-en
mailing list