我正在使用Ubuntu 14.04在Digital Ocean上运行VPS。
我设置主管运行bash脚本来导出环境变量,然后启动celery:
#!/bin/bash
DJANGODIR=/webapps/myproj/myproj
# Activate the virtual environment
cd $DJANGODIR
source ../bin/activate
export REDIS_URL="redis://localhost:6379"
...
celery -A connectshare worker --loglevel=info --concurrency=1
现在我注意到,当我进行supervisorctl停止时,主管似乎并没有杀死这些进程。此外,当我尝试手动杀死进程时,他们不会停止。如何为主管设置更好的脚本?如何终止正在运行的进程?
答案 0 :(得分:7)
您应该将stopasgroup=true
选项配置为supervisord.conf
文件。
因为您不仅要杀死父进程,还要杀死子进程。
答案 1 :(得分:5)
发送kill -9
必须杀死进程。如果supervisorctl stop
未停止您的流程,您可以尝试将stopsignal
设置为其他值之一,例如QUIT
或KILL
。
您可以在supervisord documentation中看到更多内容。