
description "HAProxy for ETS server"
author      "Claudio Cicali <claudio.cicali@gmail.com>"

start on filesystem and started networking
stop on shutdown

respawn             # restart when job dies
respawn limit 5 60  # give up restart after 5 respawns in 60 seconds

env HAPROXY=/usr/sbin/haproxy
env ETSHA_PID=/var/run/ets_haproxy.pid
env ETSHA_CONFIG=/var/www/xtribe.eu/ets/conf/haproxy.conf

expect fork

script
	exec start-stop-daemon --start --pidfile ${ETSHA_PID} --exec ${HAPROXY} -- -f ${ETSHA_CONFIG} -D -p ${ETSHA_PID}
end script

pre-stop script
  rm -f ${ETSHA_PID}
end script

