1、安裝supervisor
使用yum命令安裝(推薦)
$ sudo su - #切換為root用戶
yum install epel-release
yum install -y supervisor
systemctl enable supervisord #開機(jī)自啟動(dòng)
systemctl start supervisord # 啟動(dòng)supervisord服務(wù)
systemctl status supervisord # 查看supervisord服務(wù)狀態(tài)
ps -ef | grep supervisord # 查看是否存在supervisord進(jìn)程
2、配置開機(jī)啟動(dòng)
vim /lib/systemd/system/supervisord.service
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service nss-user-lookup.target
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl $OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=40s
[Install]
WantedBy=multi-user.target
3、supervisor配置
vim /etc/supervisord.d/yii-queue-worker.ini
[program:yii-queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/webservice/php73/bin/php /www/xxx/yii queue/listen --verbose=1 --color=0
autostart=true
autorestart=true
user=www
numprocs=4
redirect_stderr=true
stdout_logfile=/www/log/supervisor/yii-queue-worker.log
更新新的配置到supervisord
supervisorctl update
supervisorctl status:查看所有進(jìn)程的狀態(tài)
重新啟動(dòng)配置中的所有程序
supervisorctl reload
查看正在守候的進(jìn)程
supervisorctl
停止某一進(jìn)程 (program_name=你配置中寫的程序名稱)
supervisorctl stop program_name
重啟某一進(jìn)程 (program_name=你配置中寫的程序名稱)
supervisorctl restart program_name文章來源:http://www.zghlxwxcb.cn/news/detail-824896.html
停止全部進(jìn)程
supervisorctl stop all文章來源地址http://www.zghlxwxcb.cn/news/detail-824896.html
到了這里,關(guān)于centos安裝supervisor并配置,設(shè)置開機(jī)啟動(dòng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!