I'm running a few processes using supervisord, named process1, process2, ..., process8. If I want to restart process{1-4}, how can I do that with supervisorctl?

share|improve this question
up vote 133 down vote accepted

supervisord supports process groups. You can group processes into named groups and manage them collectively.

[unix_http_server]
file=%(here)s/supervisor.sock

[supervisord]
logfile=supervisord.log
pidfile=supervisord.pid

[program:cat1]
command=cat

[program:cat2]
command=cat

[program:cat3]
command=cat

[group:foo]
programs=cat1,cat3

[supervisorctl]
serverurl=unix://%(here)s/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

supervisorctl command can be called with a group name:

supervisorctl restart foo:

as well as with multiple process names:

supervisorctl restart foo:cat1 cat2
share|improve this answer
36  
It's amazing how non-trivial it was to find out that a colon needs to be appended when issuing commands to a process group. Thank you. – mafrosis Aug 17 '13 at 7:47
2  
Agreed. I think supervisorctl restart foo:* makes what's happening clearer. – Tom Jul 13 '16 at 14:29
    
So to directly answer the OP's question, you can't directly restart a specific process. You can only restart groups, which requires a group tag? – Cerin Dec 4 '16 at 23:37
    
@Cerin From my own testing, I came that exact same conclusion. Speaking anecdotally, I have tended to see a group at the end of .conf files containing all processes. As a repeated observation, this made no sense. Now it makes complete sense :) – AlanSE Feb 14 '17 at 14:46
    
You made my day :) – sumit Aug 14 '17 at 5:17

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.