supervisor 守护进程
卸载 supervisor
apt-get purge supervisor
安装supervisor
apt-get install supervisor
nano /etc/supervisor/conf.d/oa_dev_celery.conf
[program:oa_dev_celery] command=/usr/local/python3.10/bin/celery -A oa worker directory=/home/szw/data/server/oa/oa_dev/ user=root autostart=true autorestart=true redirect_stderr=true stdout_logfile=/var/log/oa_dev_celery_work.log stderr_logfile=/var/log/oa_dev_celery_work_err.log
保存并关闭文件(在 nano 编辑器中按下 Ctrl + X,然后按下 Y 以保存)。文件名以 .conf
结尾
使用以下命令重新加载 Supervisor 配置文件:
supervisorctl reread
supervisorctl update
启动 supervisor:
supervisord
停止 supervisor:
supervisorctl shutdown
查看 supervisor 状态:
supervisorctl status
启动所有被 supervisor 管理的进程:
supervisorctl start all
停止所有被 supervisor 管理的进程:
supervisorctl stop all
启动特定的进程:
supervisorctl start oa_dev_celery
停止特定的进程:
supervisorctl stop oa_dev_celery
查看特定进程的状态:
supervisorctl status oa_dev_celery
重启特定的进程:
supervisorctl restart oa_dev_celery