安装 supervisor
[[email protected] ~]# pip3 install supervisor
生成配置文件
[[email protected] ~]#echo_supervisord_conf> /etc/supervisord.conf
增加如下配置
- [include]
- files = /var/www/ipv6check/App/API/v1/drive/sv.INI
如下配置
- [[email protected] ~]# cat /var/www/ipv6check/App/API/v1/drive/sv.INI
- [program:celery]
- command=celery -A run worker --loglevel=info
- directory=/var/www/ipv6check/App/API/v1/drive/ #celer 方法目录
- stdout_logfile=/var/log/celery/check_task_out.log
- stderr_logfile=/var/log/celery/check_task_err.log
- autorestart=true
- redirect_stderr=true
- startsecs=10
- stopwaitsecs = 600
启动服务
[[email protected] ~]#supervisord
更新服务
[[email protected] ~]# supervisorctl update
客户端登录, 可以查看到启动状态
- [[email protected] ~]# supervisorctl -c /etc/supervisord.conf
- celery RUNNING pid 10923, uptime 18:22:35
可以执行以下方法
- supervisor> status
- celery RUNNING pid 10923, uptime 18:26:55
status 查看状态
reread 读取配置信息
update 加载最新的进程
stop 停止进程
start 启动进程
reload 重新加载配置
来源: http://www.bubuko.com/infodetail-3033219.html