0

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 ?

Vladimir
  • 75
  • 1
  • 9

2 Answers2

2

I'd probably reference the upstart documentation here - this example is based off one of the answers given for this question, adapting the other answers there nmay work as well. The example below should start haproxy without a PID, then have it running in the background.

respawn
console none

start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]


pre-start exec etc/init.d/haproxy start
pre-stop  etc/init.d/haproxy stop
Journeyman Geek
  • 6,969
  • 3
  • 31
  • 49
1

I set it to start on boot, and then monitor with monit (http://mmonit.com/monit/). Haven't used upstart, but this works very well for me. :)

JesseP
  • 196
  • 1
  • 1
  • 6