Supervisor是python2写就的一款强大的运维工具(其实现在已经支持Python3了 https://github.com/Supervisor/supervisor)
那么怎么利用Supervisor监控python3程序呢?本文主要讲述Supervisor在CentOS下的安装部署。
安装及设置
可通过pip3安装,如果你已经是python3的pip3,可以用一下命令安装
pip3 install git+https://github.com/Supervisor/supervisor
如果是python2,可以用CentOS (系统自带Python2)的yum安装
sudo yum install supervisor
运行echo_supervisord_conf > /etc/supervisor/supervisord.conf来产生设置,未避免产生非root用户的权限错误,将/etc/supervisor/supervisord.conf内[unix_http_server]这项改为 (修改chmod):
[unix_http_server]file=/tmp/supervisor.sock ; (the path to the socket file)chmod=0766 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket fileuid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
再将末尾的[include]部分改为: