Linux 下 Supervisor 的运行及 supervisorctl 的使用

运行 Supervisor

运行 Supervisor 至少须要在配置文件中添加一个 program 块。git

# /etc/supervisord.conf

[program:foo]
command=/bin/cat

启动:github

$BINDIR/supervisord
# 或者手动指定配置文件启动
$BINDIR/supervisord -c /etc/supervisord.conf

进程会以守护进程方式运行,并与目前的终端分离。操做日志保存在 $CWD/supervisor.log 中。日志

运行 supervisorctl

$BINDIR/supervisorctl

经常使用参数:code

-c 指定配置文件路径,默认/etc/supervisord.conf
-s supervisord 服务监听的URL地址,默认 http://localhost:9001
-u 受权服务的用户名
-p 受权服务的密码

经常使用选项:进程

# 从新加载配置并根据须要添加/删除,并将从新启动受影响的程序
supervisorctl update

# 重启远程的 supervisord
supervisorctl reload

# 重载守护进程的配置文件,不包括添加/删除(不重启)
supervisorctl reread

# 启动指定的程序
supervisorctl start <name>

# 启动指定的程序组
supervisorctl start <gname>:*

# 启动全部的程序组
supervisorctl start all

# 查看指定的程序状态
supervisorctl status <name>

# 查看全部的程序状态
supervisorctl status

# 中止指定的程序
supervisorctl stop <name>

# 中止指定的程序组
supervisorctl stop <gname>:*

# 中止全部的程序
supervisorctl stop all

信号

可在配置文件的 [supervisord] 节点的 pidfile 参数中找到进程ID。ip

  • SIGTERM:关闭 supervisord 及其全部子流程。
  • SIGINT:关闭 supervisord 及其全部子流程。
  • SIGQUIT:关闭 supervisord 及其全部子流程。
  • SIGHUP:中止全部进程、重载配置文件,启动全部进程。
  • SIGUSR2:关闭并从新打开主要的活动日志和全部的子日志文件。

开机自动运行 supervisord

https://github.com/Supervisor...get

相关文章
相关标签/搜索