Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PHP script that waits for AMQP messages. When a message comes in it is processed and after processing is done it will wait for the next message.

The problem is of course that this is blocking. If e.g. an incoming message needs me to contact an external REST API, the processing could take several seconds to complete and all that time it won't be able to process other messages.

I can start my script several times, e.g. 8 times. This way I have 8 "consumers" and this seems to work very well. However, the problem now is, how do I manage these 8 different processes?

I basically looking for some utility that allows me to specify that I want to start a particular script 8 times and then to be able monitors these processes for up time etc. Is there such utility?

share|improve this question

Use upstart.

Edit /etc/init/whateveryouwant.conf

start on runlevel [2345]



  for i in `seq 1 $CONSUMERS`
    start /fullpath/to/your/script/here CONSUMER=$i
end script
respawn limit 15 5

Then you can use service whateveryouwant start service whateveryouwant stop

share|improve this answer

Your Answer


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.