Supervisor 是 一个 Linux/Unix 系统上的进程监控工具。使用 Python 语言开发,提供 Web 管理界面,能够根据配置后台运行程序、监控程序、重启挂掉的程序等管理功能。
安装使用
在 Ubuntu 上可以使用apt-get install supervisor,在 CentOS 上可以使用yum install supervisor。但这些基于源的方式安装,可能版本比较老。所以推荐使用easy_install安装:
easy_install supervisor
生成默认配置文件:
echo_supervisord_conf > /etc/supervisord.conf
安装完后,主要有3个命令,分别是:
echo_superisord_conf - 生成默认配置文件
supervisord - 服务端
supervisorctl - 客户端
修改/etc/supervisord.conf,引入程序配置文件:
[include]
files = /etc/supervisord/*.conf
程序配置示例
[program:demo]
directory = /opt/soft/demo/
command = /opt/soft/demo/demo
autostart = true
autorestart = true
startsecs = 5
user = upfor
redirect_stderr = true
stdout_logfile = /var/log/supervisord/stdout.demo.log
stdout_logfile_maxbytes = 1MB
stdout_logfile_backups = 10
stdout_capture_maxbytes = 1MB
stderr_logfile = /var/log/supervisord/stderr.demo.log
stderr_logfile_maxbytes = 1MB
stderr_logfile_backups = 10
stderr_capture_maxbytes = 1MB
文章作者 Jioby
51reboot golang课程第4期6.15日开课
51reboot 运维前端课程正在火热招生中
详情联系WeChat;17812796384