Upstart haproxy script


#1

Proper upstart init script for haproxy(that supports reload), can also be used for other PID1 managers or in legacy systems.

# haproxy

start on runlevel [2345]
stop on runlevel [!2345]

env CONF=/etc/haproxy/haproxy.cfg

nice 10
respawn
respawn limit 2 5
reload signal USR2

pre-start script
    /usr/sbin/haproxy -c -q -f $CONF
end script

post-stop script
    rm -f /var/run/haproxy.pid
end script

exec /usr/sbin/haproxy -Ds -f $CONF -p /var/run/haproxy.pid