一、安装
yum -y install supervisor
二、配置
1.生成配置文件
#如果配置没有配置文件,使用echo_supervisord_conf生成
echo_supervisord_conf > /etc/supervisord.conf
2.启动
systemctl start supervisord
查看 supervisord 是否在运行:
ps -ef | grep supervisord
3.加入开机启动
systemctl enable supervisord
systemctl is-enabled supervisord
4.编辑配置文件
vim /etc/supervisord.conf
;启动单个模式
[program:api]
command=/bin/php artisan queue:work
numprocs=1
directory=/home/wwwroot/www.aaa.com
user=www
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/api.log
;启动多个进场配置
[program:dev-queue]
process_name=%(program_name)s_%(process_num)02d
command=/bin/php artisan queue:work
numprocs=10
directory=/www/wwwroot/www.aaa.com
user=www
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/dev-queue.log
5.重新加载配置
#重新加载配置
supervisorctl update
#supervisorctl reload
#查看运行状态
supervisordctl status
dev-queue:dev-queue_00 RUNNING pid 28873, uptime 0:03:20
dev-queue:dev-queue_01 RUNNING pid 28874, uptime 0:03:20
dev-queue:dev-queue_02 RUNNING pid 28871, uptime 0:03:20
dev-queue:dev-queue_03 RUNNING pid 28872, uptime 0:03:20
dev-queue:dev-queue_04 RUNNING pid 28877, uptime 0:03:20
dev-queue:dev-queue_05 RUNNING pid 28878, uptime 0:03:20
dev-queue:dev-queue_06 RUNNING pid 28875, uptime 0:03:20
dev-queue:dev-queue_07 RUNNING pid 28876, uptime 0:03:20
dev-queue:dev-queue_08 RUNNING pid 28869, uptime 0:03:20
dev-queue:dev-queue_09 RUNNING pid 28870, uptime 0:03:20
网友评论