LinMinquan's Blog

Experience technology to change life

Centos 6 Supervisor 开机启动

环境:阿里云Centos 6,Python ,Flask,Gunicorn,Supervisor,Nginx

参考资料:

链接1:centos下通过gunicorn+nginx+supervisor部署Flask项目

链接2:进程管理工具supervisor的使用注意事项

链接3:Setting Up Python and Supervisor on CentOS

链接4:supervisor+gunicorn部署python web项目

链接5:How to control your deamon with Supervisord (On CentOS)

1、supervisor是否要在虚拟环境中安装?

我想了想觉得应该是得在系统中安装。

2、supervisor的配置文件放在哪呢?

原本是放在每个项目的虚拟环境目录下,最佳实践(参考链接3,链接4)是在/etc/目录下建个默认的配置文件

echo_supervisord_conf > supervisord.conf

然后编辑这个配置文件,在最后让这个配置文件include指定目录下的配置文件

[include]

files = /etc/supervisord.d/*.conf

supervisord.d这个目录也是得自己新建,mkdir /etc/supervisord.d/

然后再在/etc/supervisord.d/目录里放置所有的supervisor的配置文件。

3、怎样让Centos开机时就让supervisor启动这些配置文件呢?

vi /etc/rc.d/rc.local

在rc.local里直接写 supervisord -c /etc/supervisord.conf 还不行,还得写全supervisord所在的路径。我这里也让nginx开机启动了。


Share