-
supervisor 是linux系统的一个进程管理工具。
-
1、安装
pip install supervisor
-
2、创建一个配置文件
echo_supervisord_conf > /etc/supervisord.conf
-
3、修改配置文件
把 /tmp/supervisor.sock,/tmp/supervisord.log ,/tmp/supervisord.pid
改成自己的目录,tmp 目录下会被linux 清除掉。
我的改成了 file=/var/run/supervisor.sock
logfile=/temp/supervisord.log
pidfile=/var/run/supervisord.pid
修改/var/run/ 目录的权限 或者修改所属的用户
取消服务的配置文件的注释如下图
- 4 在/etc/supervisor/conf.d/*.ini,编写服务的配置文件。我的配置文件如下
- 5 启动服务
supervisord
在命令行输入supervisorctl 进入命令行工具
启动python 服务
start foo # 因为我在foo.ini 配置文件中配置的服务名是foo
如图;
开启supervisord 的网页管理
在supervisord.conf中进行修改。如图
开启后页面的样子如图
参考连接
http://supervisord.org/installing.html