supervisord
相信大多数人都用过 python 版本的 supervisor ,那么你知道 go 版本的 supervisor 吗?
ochinchina/supervisord
源码安装:
git clone https://github.com/ochinchina/supervisord.git
// 切换到需要的版本分支
git checkout v0.7.3
// linux 编译安装
// 64位版本
env GOOS=linux GOARCH=amd64 go build -o supervisord_linux_amd64
配置文件demo
// 内网地址
[inet_http_server]
port = :9001
// UI地址
[supervisorctl]
serverurl=http://127.0.0.1:9001
// 进程配置
[program:hello]
directory = Work/golang/
command =
stdout_logfile =
stderr_logfile =
autostart = true
user=
// depends_on=B, C
启动命令
supervisord -c supervisor.conf -d
ctl 命令
// 不是9001端口,务必指定-s参数
supervisord ctl -s=http://localhost:9010 status
supervisord ctl -s=http://localhost:9010 status program-1 program-2...
supervisord ctl -s=http://localhost:9010 status group:*
supervisord ctl stop program-1 program-2...
supervisord ctl stop group:*
supervisord ctl stop all
supervisord ctl -s=http://localhost:9010 start program-1 program-2...
supervisord ctl start group:*
supervisord ctl start all
supervisord ctl shutdown
supervisord ctl reload
supervisord ctl signal <signal_name> <process_name> <process_name> ...
supervisord ctl signal all
supervisord ctl pid <process_name>
supervisord ctl fg <process_name>
supervisord
https://blog.puresai.com/2022/01/29/384/