supervisor使用要点

作用:对运行脚本的监控【采用fork/exec的方式,将可执行文件对应的进程作为supervisor的子进程进行管理】,失败自动重启脚本。

可以为某个脚本生成单独的配置文件

echo_supervisord_conf > /etc/supervisor/conf.d/****.conf

启动supervisor

supervisord -c /etc/supervisor/****.conf   /* 启动配置文件中的program */

查看有哪些supervisord

ps aux | grep supervisord

查看某个conf对应的supervisord状况

supervisorctl -c ****.conf status   /* 对配置文件中的各个program进行管理 */

更改/新增配置文件后,需要先reload+restart,才能生效!

supervisorctl -c ****.conf reload

supervisorctl -c ****.conf restart ***

常见错误:

1)在启动supervisord时,发生

Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting

需要删除/tmp/目录下的supervisor.sock文件,即unlink supervisor.sock

个人理解:sock文件沟通linux进程间通信,supervisorctl通过该文件,实现本地连接supervisord。

sock文件错误,导致一系列问题,深入原因后续研究。

2)在supervisorctl -c **.conf status没有输出时,尝试先kill掉supervisor,再回到错误1)是否发生。

3)当发现脚本并未真正监控时(脚本kill掉,无法自动挂起),尝试supervisorctl -c **.conf reload 和restart。

若要用浏览器来管理,需要配置inet_http_server

猜你喜欢

转载自blog.csdn.net/qm5132/article/details/82722243