1、安装supervisor
使用yum命令安装(推荐)
$ sudo su - #切换为root用户
yum install epel-release
yum install -y supervisor
systemctl enable supervisord #开机自启动
systemctl start supervisord # 启动supervisord服务
systemctl status supervisord # 查看supervisord服务状态
ps -ef | grep supervisord # 查看是否存在supervisord进程
2、配置开机启动
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:查看所有进程的状态
重新启动配置中的所有程序
supervisorctl reload
查看正在守候的进程
supervisorctl
停止某一进程 (program_name=你配置中写的程序名称)
supervisorctl stop program_name
重启某一进程 (program_name=你配置中写的程序名称)
supervisorctl restart program_name文章来源:https://www.toymoban.com/news/detail-824896.html
停止全部进程
supervisorctl stop all文章来源地址https://www.toymoban.com/news/detail-824896.html
到了这里,关于centos安装supervisor并配置,设置开机启动的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!