how to restart only certain processes using supervisorctl?
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
Since supervisorctl
accepts multiple processes on the command line, you can take advantage of shell brace expansion (e.g. in Bash) to control multiple processes:
supervisorctl restart process{1..4}
is expanded by the shell into
supervisorctl restart process1 process2 process3 process4
as if you had typed that out explicitly.