how to restart only certain processes using supervisorctl?

痴心易碎 提交于 2019-11-28 14:04:22

问题


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?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/9301494/how-to-restart-only-certain-processes-using-supervisorctl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!