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.

Suppose I have a supervisor's config file like this:

[program:type1_X]
command=my_program_1 X

[program:type1_Y]
command=my_program_1 Y

...

[program:type2_X]
command=my_program_2 X

[program:type2_Y]
command=my_program_2 Y

...

[group:type1]
programs=type1_X,type1_Y

[group:type2]
programs=type2_X,type2_Y

[group:type]
programs:type1_X,type1_Y,type2_X,type2_Y

So what I'm dong is defining two types of programs (my_program_(X|Y)) that runs with two sets of different parameters (X&Y). Then I group programs on the type of program they are running (type(X|Y)), and then I have one other group (type) that includes all defined programs above (there could be other unrelated programs in the config file).

The problem with this is, that supervisor will start each program twice since it appears in two different groups. So my question is: is there a way to have one program in multiple groups but only start it once (or however times the program defines itself (via "numprocs"))?

edit: Is there really no one who can help?

share|improve this question

1 Answer 1

You could replace the program with a shell script that will create a lock or semaphore to start one or a limited number of instances.

share|improve this answer
    
So you would replace supervisor? –  Jan Hančič Apr 23 '12 at 7:32
    
Depends, if it does not fit the bill, yes. If you needed it for other functionality/reasons, I would adapt it to the current requirements. –  Mircea Vutcovici Apr 23 '12 at 15:07
    
It fits the bill perfectly. So what you are proposing isn't really an answer ... –  Jan Hančič Apr 24 '12 at 6:05

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.