1.使用 supervisor 保持队列运行
2.增加监控任务
因 supervisor 配置中
[include]
files = /usr/local/etc/supervisor/conf.d/*.conf
保存到 /usr/local/etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/forge/app.com/artisan queue:work redis --time=8 --sleep=3 --tries=3
autostart=true
autorestart=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker.log
例子 2
[program:laravel-worker]
command=php /Users/spkinger/Desktop/gj/app/gj_app/artisan queue:work redis --queue=voucher-worker --sleep=3 --tries=2 --timeout=8
autostart=true
autorestart=true
user=spkinger
numprocs=1
redirect_stderr=true
stdout_logfile=/Users/spkinger/laravel/worker.log
3.启动
启动 supervisor
supervisord -c /usr/local/etc/supervisord.conf
加载任务
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
4.修改
修改配置,重启生效
sudo supervisorctl update
修改任务代码,重启生效
sudo supervisorctl restart laravel-worker:*
5.当 supervisorctl 报错
error: <class 'socket.error'>, [Errno 101] Network is unreachable: file: /usr/lib64/python2.7/socket.py line: 571
使用如下方式运行
supervisorctl -c /usr/local/etc/supervisord.conf reread
supervisorctl -c /usr/local/etc/supervisord.conf update
supervisorctl -c /usr/local/etc/supervisord.conf start laravel-worker:*
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于