how to restart only certain processes using supervisorctl?

Thi Duong Nguyen picture Thi Duong Nguyen · Feb 15, 2012 · Viewed 111k times · Source

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?

Answer

mher picture mher · Feb 16, 2012

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