我正在使用supervisord运行一些进程,名为process1,process2,...,process8.如果我想重启进程{1-4},我怎么能用supervisorctl做到这一点?
mhe*_*her 161
supervisord支持进程组.您可以将进程分组到命名组中并集中管理它们.
[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
Run Code Online (Sandbox Code Playgroud)
可以使用组名称调用supervisorctl命令:
supervisorctl restart foo:
Run Code Online (Sandbox Code Playgroud)
以及多个进程名称:
supervisorctl restart foo:cat1 cat2
Run Code Online (Sandbox Code Playgroud)
由于supervisorctl在命令行上接受多个进程,您可以利用 shell 括号扩展(例如在 Bash 中)来控制多个进程:
supervisorctl restart process{1..4}
Run Code Online (Sandbox Code Playgroud)
被壳展开成
supervisorctl restart process1 process2 process3 process4
Run Code Online (Sandbox Code Playgroud)
就好像你已经明确地输入了一样。
| 归档时间: |
|
| 查看次数: |
85792 次 |
| 最近记录: |