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

I want to run multiple instances of my process by passing an args to startup job:

start myapp instance1
start myapp instance2 

and so on

I want to have one upstart conf file instead of having conf files as many as instances of my app. Is it possible ?

share|improve this question

1 Answer 1

I realize the question is a bit old, but I'll go ahead and answer it. :)

Yes, you can do this, and you use the upstart "instance" clause to do it.

Here is a simple example (using a PHP based job in this case).

description "Async insert workers"
author      "Mike Grunder"

env SCRIPT_PATH="/path/to/my/script"

# This is the key bit
instance $N

script
    php $SCRIPT_PATH/worker.php
end script

If you see in that script, you've got an instance $N line. You specify the instance like so:

start the-job N=instance1
start the-job N=instance2

Obviously you could change N to whatever you like.

Now I'm back on my quest to figure out how to start a number of them automatically! :)

share|improve this answer

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.