Reputation: 335
I am starting HA proxy using the following command:
sudo etc/init.d/haproxy start
and I stop HA proxy using:
sudo etc/init.d/haproxy stop
How can I write a basic upstart script for sudo etc/init.d/something start or stop ?
Upvotes: 3
Views: 1436
Reputation: 2177
The following script will work. Put it in "/etc/init/haproxy.conf", then you can start the haproxy service with "service haproxy start". Be sure to check the location of the configuration file
# HAProxy
description "HAProxy"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 2 5
env CONF=/etc/haproxy/haproxy.cfg
pre-start script
[ -r $CONF ]
end script
exec /usr/local/sbin/haproxy -db -f $CONF
Upvotes: 4