xzf158
6/21/2016 - 2:17 AM

supervisord 安装、配置、开机启动及laravel相关配置.md

安装supervisor

yum install supervisor

配置文件

/etc/supervisord.conf

开启任务

sudo supervisord -c /etc/supervisord.conf

操作

sudo supervisorctl -c /etc/supervisord.conf

关闭

/etc/init.d/supervisord stop

查看目标

tail -f /var/log/supervisor/supervisord.log

配置开机启动 添加Supervisor的service控制命令:

cd /etc/rc.d/init.d
wget https://raw.githubusercontent.com/Supervisor/initscripts/master/redhat-init-mingalevme
mv redhat-init-mingalevme supervisord
chmod +x supervisord

vim supervisord,将其中的PREFIX=/usr改为PREFIX=/usr/local,然后service supervisord start就可启动。

最后,执行如下的命令,配置supervisord为开机启动:

chkconfig --add supervisord
chkconfig supervisord on

参考网址:http://wiki.hustlzp.com/post/linux/centos-6-python

配置laravel队列, 在/etc/supervisord.conf里添加:

[include]
files = supervisord.d/*.conf

在新建/etc/supervisord.d/laravel.conf文件,添加如下配置。

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /laravel_site_path/artisan queue:work --sleep=1 --tries=3 --daemon
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/laravel_site_path/storage/logs/worker.log

启动一下supervisord,再看看日志,就知道laravel队列有没有正常工作了。

#####强制关闭

ps -ef | grep supervisord
kill -9 ***