## 1.安装supervisor pip install supervisor ## 2.echo_supervisord_conf命令得到supervisor配置模板,打开终端执行如下Linux shell命令: echo_supervisord_conf > supervisord.conf ## 3.vim命令打开该文件并编辑: vim supervisord.conf ## 4.supervisord.conf在最后一行添加内容: [program:celery.worker] ;指定运行目录 directory=/home/xxx/xxx/project/ ;运行目录下执行命令 command=celery -A xxx.celery_tasks.tasks:celery worker -l info -B ;启动设置 numprocs=1 ;进程数 autostart=true ;当supervisor启动时,程序将会自动启动 autorestart=true ;自动重启 ;停止信号,默认TERM ;中断:INT (类似于Ctrl+C)(kill -INT pid),退出后会将写文件或日志(推荐) ;终止:TERM (kill -TERM pid) ;挂起:HUP (kill -HUP pid),注意与Ctrl+Z/kill -stop pid不同 ;从容停止:QUIT (kill -QUIT pid) stopsignal=INT ## 4.启动supervisor: supervisord -c supervisord.conf ## 5.关闭supervisord需要通过supervisor的控制器: supervisorctl -c supervisord.conf shutdown ## 6.重启supervisord也是通过supervisor的控制器 supervisorctl -c supervisord.conf reload
原文:https://www.cnblogs.com/debochan/p/10823984.html