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

Vincent Bernat bernat at debian.org
Mon Nov 9 13:42:05 UTC 2015


 ❦  9 novembre 2015 15:09 +0200, Apollon Oikonomopoulos <apoikos at debian.org> :

>> 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.
>
> IOW, something along these lines:
>
> diff --git a/debian/haproxy.init b/debian/haproxy.init
> index 35af505..2852efa 100644
> --- a/debian/haproxy.init
> +++ b/debian/haproxy.init
> @@ -62,8 +62,10 @@ haproxy_stop()
>  
>         ret=0
>         for pid in $(cat $PIDFILE); do
> +               tmppid="$(mktemp)"
>                 start-stop-daemon --quiet --oknodo --stop \
> -                       --retry 5 --pid $pid --exec $HAPROXY || ret=$?
> +                       --retry 5 --pidfile "$tmppid" --exec $HAPROXY || ret=$?
> +               rm -f "$tmppid"
>         done
>  
>         [ $ret -eq 0 ] && rm -f $PIDFILE
>
>
> Note that s-s-d has a '--remove-pidfile' option, but this is again too
> new (>= 1.17.19).

This one seems good for me too.
-- 
Make your program read from top to bottom.
            - The Elements of Programming Style (Kernighan & Plauger)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-haproxy-maintainers/attachments/20151109/c276fa0a/attachment.sig>


More information about the Pkg-haproxy-maintainers mailing list