Bug#825870: sysvinit-utils: Second stop command does not use process matchers name and pidfile
Ah, now I see the rm -f $PIDFILE haha. So yeah you're right. On May 31, 2016 17:40, "Andreas Henriksson" wrote: > Hello Steven Roose. > > On Tue, May 31, 2016 at 02:15:10AM +0200, Steven Roose wrote: > [...] > > The daemon does not make it's own pidfile, so I added following relevant > variables: > > PIDFILE=/pidfile > > START_ARGS=" --make-pidfile" > > STOP_ARGS=" --remove-pidfile" > [...] > > --- a/debian/init-d-script > > +++ b/debian/init-d-script > > @@ -95,7 +95,7 @@ do_stop_cmd() { > > # sleep for some time. > > start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ > > $STOP_ARGS \ > > - --exec $DAEMON > > + ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME --exec $DAEMON > > [ "$?" = 2 ] && return 2 > > # Many daemons don't delete their pidfiles when they exit. > > rm -f $PIDFILE > [...] > > While I think your patch looks good please note that there's no > point in using STOP_ARGS=" --remove-pidfile" given the last quoted > line above which will unconditionally remove any pidfile. > > The workaround for your issue is thus very simple. Just drop > STOP_ARGS=" --remove-pidfile" > > Hope this helps. > > Regards, > Andreas Henriksson >
Bug#825870: sysvinit-utils: Second stop command does not use process matchers name and pidfile
Hello Steven Roose. On Tue, May 31, 2016 at 02:15:10AM +0200, Steven Roose wrote: [...] > The daemon does not make it's own pidfile, so I added following relevant > variables: > PIDFILE=/pidfile > START_ARGS=" --make-pidfile" > STOP_ARGS=" --remove-pidfile" [...] > --- a/debian/init-d-script > +++ b/debian/init-d-script > @@ -95,7 +95,7 @@ do_stop_cmd() { > # sleep for some time. > start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ > $STOP_ARGS \ > - --exec $DAEMON > + ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME --exec $DAEMON > [ "$?" = 2 ] && return 2 > # Many daemons don't delete their pidfiles when they exit. > rm -f $PIDFILE [...] While I think your patch looks good please note that there's no point in using STOP_ARGS=" --remove-pidfile" given the last quoted line above which will unconditionally remove any pidfile. The workaround for your issue is thus very simple. Just drop STOP_ARGS=" --remove-pidfile" Hope this helps. Regards, Andreas Henriksson
Bug#825870: sysvinit-utils: Second stop command does not use process matchers name and pidfile
Are you sure? If that is the case, that what is --remove-pidfile for? I thought to understand from the docs that --pidfile is only used to identify the process, but thst start-stop-daemon considers pidfile handling to he done by the daemon. And that --make-pidfile and --remove-pidfile are to make start-stop-daemon do this for you. However I have little experience, will test asap dropping the argument. On May 31, 2016 17:40, "Andreas Henriksson" wrote: > Hello Steven Roose. > > On Tue, May 31, 2016 at 02:15:10AM +0200, Steven Roose wrote: > [...] > > The daemon does not make it's own pidfile, so I added following relevant > variables: > > PIDFILE=/pidfile > > START_ARGS=" --make-pidfile" > > STOP_ARGS=" --remove-pidfile" > [...] > > --- a/debian/init-d-script > > +++ b/debian/init-d-script > > @@ -95,7 +95,7 @@ do_stop_cmd() { > > # sleep for some time. > > start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ > > $STOP_ARGS \ > > - --exec $DAEMON > > + ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME --exec $DAEMON > > [ "$?" = 2 ] && return 2 > > # Many daemons don't delete their pidfiles when they exit. > > rm -f $PIDFILE > [...] > > While I think your patch looks good please note that there's no > point in using STOP_ARGS=" --remove-pidfile" given the last quoted > line above which will unconditionally remove any pidfile. > > The workaround for your issue is thus very simple. Just drop > STOP_ARGS=" --remove-pidfile" > > Hope this helps. > > Regards, > Andreas Henriksson >
Bug#825870: sysvinit-utils: Second stop command does not use process matchers name and pidfile
Package: sysvinit-utils Version: 2.88dsf-59 Severity: normal Tags: patch Dear Maintainer, *** Reporter, please consider answering these questions, where appropriate *** * What led up to the situation? I used /etc/init.d/skeleton to make a script for a daemon. The daemon does not make it's own pidfile, so I added following relevant variables: PIDFILE=/pidfile START_ARGS=" --make-pidfile" STOP_ARGS=" --remove-pidfile" NAME= DAEMON= * What exactly did you do (or not do) that was effective (or ineffective)? /etc/init.d/mydaemon start /etc/init.d/mydaemon stop * What was the outcome of this action? The following error message: "start-stop-daemon: --remove-pidfile requires --pidfile" * What outcome did you expect instead? The daemon would be stopped. -- System Information: Debian Release: 8.4 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=locale: Cannot set LC_ALL to default locale: No such file or directory UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages sysvinit-utils depends on: ii libc62.19-18+deb8u4 ii libselinux1 2.3-2 ii startpar 0.59-3 sysvinit-utils recommends no packages. Versions of packages sysvinit-utils suggests: pn bootlogd pn sash -- debconf information excluded >From db2dcfa27188f4ba983f7bf74564ee942d8464b9 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Tue, 31 May 2016 01:56:44 +0200 Subject: [PATCH] Fix problem in do_stop_cmd() of init-d-script The second stop command does not contain the --name and --pidfile identifiers. --- debian/init-d-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/init-d-script b/debian/init-d-script index 334dc32..3b2a51d 100755 --- a/debian/init-d-script +++ b/debian/init-d-script @@ -95,7 +95,7 @@ do_stop_cmd() { # sleep for some time. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ $STOP_ARGS \ - --exec $DAEMON + ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME --exec $DAEMON [ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE -- 1.9.1 >From db2dcfa27188f4ba983f7bf74564ee942d8464b9 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Tue, 31 May 2016 01:56:44 +0200 Subject: [PATCH] Fix problem in do_stop_cmd() of init-d-script The second stop command does not contain the --name and --pidfile identifiers. --- debian/init-d-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/init-d-script b/debian/init-d-script index 334dc32..3b2a51d 100755 --- a/debian/init-d-script +++ b/debian/init-d-script @@ -95,7 +95,7 @@ do_stop_cmd() { # sleep for some time. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ $STOP_ARGS \ - --exec $DAEMON + ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME --exec $DAEMON [ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE -- 1.9.1