如何使用supervisorctl仅重新启动某些进程?

发布于 2025-01-05 12:05:09 字数 108 浏览 0 评论 0原文

我正在使用 Supervisord 运行一些进程,名为 process1、process2、...、process8。如果我想重新启动进程{1-4},我该如何使用supervisorctl来做到这一点?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

临风闻羌笛 2025-01-12 12:05:09

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

可以使用组名:

supervisorctl restart foo:

以及多个进程名来调用supervisorctl命令:

supervisorctl restart foo:cat1 cat2

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
简美 2025-01-12 12:05:09

由于supervisorctl在命令行上接受多个进程,因此您可以利用shell大括号扩展(例如在Bash中)来控制多个进程:

supervisorctl restart process{1..4}

由shell扩展为

supervisorctl restart process1 process2 process3 process4

好像你已经明确地输入了该内容。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文