[Pkg-haproxy-maintainers] Bug#804530: Bug#804530: Bug#804530: Bug#804530: haproxy: Ensure stop action works on pre-systemd versions of Debian (and Ubuntu)

Apollon Oikonomopoulos apoikos at debian.org
Mon Nov 9 13:01:04 UTC 2015


Hi James, Vincent,

On 13:13 Mon 09 Nov     , Vincent Bernat wrote:
>  ❦  9 novembre 2015 11:51 GMT, James Page <james.page at ubuntu.com> :
> 
> > How would you feel about using:
> >
> > for pid in $(cat $PIDFILE); do
> > if start-stop-daemon --help | grep -q "\-\-pid "; then
> > start-stop-daemon --quiet --oknodo --stop \
> > --retry 5 --pid $pid --exec $HAPROXY || ret=$?
> > else
> > if kill -0 $pid 2> /dev/null; then
> > /bin/kill $pid || ret=4
> > fi
> > fi
> > done
> >
> > This would preserve use of stop-start-daemon if the version installed
> > supported --pid, and drop back to the kill approach if not.
> 
> Personally, I find this too hacky and not worth it. For example, if
> start-stop-daemon sends its output to stderr (unlikely, but...), this
> will break. Or if start-stop-daemon reduces its help message to only a
> mention of the manual page.
> 
> Apollon, what do you think?

The reason for using start-stop-daemon is two-fold: first of all, it 
reliably matches the PID with the executable and won't kill unrelated 
processes. Second, it waits until the process exits, making the 
initscripts behavior more reliable. IMHO, both reasons are important 
enough to not revert to the kill loop.

If we're going to support this, I would like to avoid parsing program 
output. We could check the dpkg version (e.g. using dpkg 
--compare-versions) and fall back to the kill loop if dpkg is older than 
1.17.6, or we could keep the loop as is but create a temporary pidfile 
for each PID and pass the temporary pidfile to start-stop-daemon with 
`--pidfile` instead of `--pid`. Both approaches sound a bit hackish, but 
the second is probably less so.

Cheers,
Apollon



More information about the Pkg-haproxy-maintainers mailing list