[Pkg-sysvinit-devel] Bug#643337: dpkg: start-stop-daemon can't handle script daemon

Guillem Jover guillem at debian.org
Wed Apr 11 05:15:40 UTC 2012


severity 643337 wishlist
clone 643337 -1
retitle 643337 dh-make: Template could indicate when to use s-s-d --name/--exec
reassign 643337 dh-make
retitle -1 initscripts: Template could indicate when to use s-s-d --name/--exec
reassign -1 initscripts
thanks

On Sun, 2012-01-15 at 00:15:31 +0100, Martin Stigge wrote:
> I'm reopening the bug because I ran into the same problem trying
> to write an initscript for a python daemon. Problem here is that
> the default initscript created by dh-make gives the following:
> 
> start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
> 	|| return 1
> start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
> 	$DAEMON_ARGS \
> 	|| return 2

> This causes the exact trouble as described by Étienne: the test
> in the first call will still succeed if run again after the
> second call. This results in the initscript launching another
> instance of the deamon (via the seemingly oblivious
> start-stop-deamon).
> 
> I'm aware that this does not necessarily have to be considered a
> bug in start-stop-daemon, rather its use (and maybe a little bit
> of inconsistency in behavior, see #202719, or deficiency in
> documentation, see #367608).

The last one is fixed now.

> I'm happy to reassign this elsewhere
> (possibly dh-make?) but somewhere we should have it documented,
> in case anyone else bumps into this.

Doing so now to dh-make and initscripts (for /etc/init.d/skeleton).

> For the record, I replaced the above by something like this:
> 
> start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
> 	--name $NAME --test > /dev/null \
> 	|| return 1
> start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
> 	--name $NAME -- \
> 	$DAEMON_ARGS \
>         || return 2
> 
> Instead of --exec, this uses --name to match the process in case
> it exists and --startas to launch a new one in case it doesn't.
> 
> If I got something terribly wrong, please tell me, otherwise
> please indicate where to forward this.

No, this all looks right, --name should usually be used on interpreted
scripts and --exec otherwise.

thanks,
guillem



More information about the Pkg-sysvinit-devel mailing list