Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
thank you very much. I will try that –  Vladimir Oct 15 '12 at 14:20

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. :)

share|improve this answer
    
That seems to work. Thanks for the help –  Vladimir Oct 15 '12 at 14:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.