安装
http://www.supervisord.org/installing.html
1 | pip install supervisor |
status
1 | ❯ supervisorctl -c /opt/supervisor/supervisord.conf status |
stop
1 | supervisorctl stop all |
FATAL & BACKOFF
Exited too quickly (process log may have details) 反复执行会复现,执行太快
2024-08-04 16:39:32,933 WARN exited: spug-api (exit status 0; not expected)
2024-08-04 16:39:32,948 WARN exited: spug-ws (exit status 0; not expected)脚本有判断exit 0
[ “$num” -eq 0 ] || { echo “runing….” && exit 0 ;}
exec gunicorn -b 127.0.0.1:8000 -w 2 –threads 8 –access-logfile - spug.wsgi
修改为
num=$(ps -ef | grep “/opt/tools/spug-3.0/spug_api/venv/bin/python3.9 /opt/tools/spug-3.0/spug_api/venv/bin/gunicorn” | grep -v grep | wc -l)
[ “$num” -eq 0 ] && {
echo “start runing….”
exec gunicorn -b 127.0.0.1:8000 -w 2 –threads 8 –access-logfile - spug.wsgi
}
supervisor 停止时,gunicorn运行状态
pids=$( ps -ef | grep “/opt/tools/spug-3.0/spug_api/venv/bin/python3.9 /opt/tools/spug-3.0/spug_api/venv/bin/gunicorn” | grep -v grep | awk ‘{print $2}’ | tr ‘\n’ ‘ ‘ )
[ -z “$pids” ] || { echo “runing …$pids” && kill -9 $pids ;}
exec gunicorn -b 127.0.0.1:8000 -w 2 –threads 8 –access-logfile - spug.wsgi