Write the Code. Change the World.

5月 20

centos7安装supervisor

方式一: yum 安装

yum install epel-release

yum install supervisor

systemctl enable supervisord # 开机自启动

systemctl start supervisord # 启动supervisord服务

systemctl status supervisord # 查看supervisord服务状态

ps -ef|grep supervisord # 查看是否存在supervisord进程

方式二: apt-get 安装

apt-get install supervisor

操作

systemctl stop supervisord
systemctl start supervisord
systemctl status supervisord
systemctl reload supervisord
systemctl restart supervisord

使用之前

cat /etc/supervisord.conf

在最底部,会看到:

files = supervisord.d/*.ini

这个会调用 supervisord.d 目录下的配置文件。所以我们的配置文件都建在 supervisord.d 下。

使用

vim mlxiu-queue.ini

[program:mlxiu]
process_name=%(program_name)s_%(process_num)02d
command=/alidata/service/php/bin/php /alidata/www/www.mlxiu.com/artisan queue:work redis --sleep=3 --tries=3
autostart=true
autorestart=true
user=nginx
numprocs=8
redirect_stderr=true
stdout_logfile=/alidata/logs/supervisord/www.yueqiubao.net.txt

stdout_logfile 文件一定要先创建好哈。

参考

https://learnku.com/articles/28919

https://blog.csdn.net/donggege214/article/details/80264811

https://blog.csdn.net/kkevinyang/article/details/80539940?utm_source=blogxgwz3