rc-script daemon (was Re: Fwd: Re: mldonkey.init)
Elan Ruusamäe
glen at delfi.ee
Sat Jan 15 17:18:54 CET 2005
On Saturday 15 January 2005 16:52, Elan Ruusamäe wrote:
> it's bug of rc-scripts imho, it should ensure the nice level specified is
> set for program.
perhaps make rc-scripts use start-stop-daemon from dpkg (well it need not to
be dpkg dep, indeed), because it doesn't suffer such problems
# /usr/sbin/start-stop-daemon -c mldonkey -N 20 --exec /bin/nice --start
19
# /usr/sbin/start-stop-daemon -c mldonkey -N 20 --exec /bin/id --start
uid=47(mldonkey) gid=33(mldonkey) groups=33(mldonkey)
btw, there's the same program source in SysVinit contrib dir, but it's rather
oudated.
only problem i see now, that it needs as parameter a program to execute, not a
shell script, like it's used in few places. but that's easy to overcame, a
separate shell script that does the scripting.
# /usr/sbin/start-stop-daemon --help
start-stop-daemon VERSION for Debian - small and fast C version written by
Marek Michalkiewicz <marekm at i17linuxb.ists.pwr.wroc.pl>, public domain.
Usage:
start-stop-daemon -S|--start options ... -- arguments ...
start-stop-daemon -K|--stop options ...
start-stop-daemon -H|--help
start-stop-daemon -V|--version
Options (at least one of --exec|--pidfile|--user is required):
-x|--exec <executable> program to start/check if it is running
-p|--pidfile <pid-file> pid file to check
-c|--chuid <name|uid[:group|gid]>
change to this user/group before starting process
-u|--user <username>|<uid> stop processes owned by this user
-g|--group <group|gid> run process as this group
-n|--name <process-name> stop processes with this name
-s|--signal <signal> signal to send (default TERM)
-a|--startas <pathname> program to start (default is <executable>)
-C|--chdir <directory> Change to <directory>(default is /)
-N|--nicelevel <incr> add incr to the process's nice level
-b|--background force the process to detach
-m|--make-pidfile create the pidfile before starting
-R|--retry <schedule> check whether processes die, and retry
-t|--test test mode, don't do anything
-o|--oknodo exit status 0 (not 1) if nothing done
-q|--quiet be more quiet
-v|--verbose be more verbose
Retry <schedule> is <item>|/<item>/... where <item> is one of
-<signal-num>|[-]<signal-name> send that signal
<timeout> wait that many seconds
forever repeat remainder forever
or <schedule> may be just <timeout>, meaning <signal>/<timeout>/KILL/<timeout>
Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo)
3 = trouble 2 = with --retry, processes wouldn't die
--
glen
More information about the pld-devel-en
mailing list