On Mon, Nov 9, 2015 at 11:21 AM, James Page <james.p...@ubuntu.com> wrote:

> On Mon, Nov 9, 2015 at 11:06 AM, Vincent Bernat <ber...@debian.org> wrote:
>
>> > Right - I see; I guess the benefit of using start-stop-daemon is that
>> > it will only kill haproxy processes, whereas the kill loop is
>> > indiscriminate.
>>
>> Yes. This is error-prone (and I just noticed that I have the same
>> problem in my backport of 1.6 for Trusty) but I think that the best for
>> now is to stay as is. We could create PID files for each PID, but this
>> won't look clean.
>>
>
> Agreed - I think your kill based approach is OK and avoids such
> complexity.
>

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.

Would ease backporting to older Debian/Ubuntu versions.

Reply via email to