supervisord停止子进程 [英] supervisord stopping child processes
问题描述
一个问题,我面对supervisord是,当我有一个命令这反过来又产生另一个过程,supervisord无法杀死它。
One of the problems, I face with supervisord is that when I have a command which in turn spawns another process, supervisord is not able to kill it.
例如我有一个正常运行的时候就像
For example I have a java process which when runs normally is like
$ zkServer.sh start-foreground
$ ps -eaf | grep zk
user 30404 28280 0 09:21 pts/2 00:00:00 bash zkServer.sh start-foreground
user 30413 30404 76 09:21 pts/2 00:00:10 java -Dzookeeper.something..something
该supervisord配置文件如下:
The supervisord config file looks like:
[program:zookeeper]
command=zkServer.sh start-foreground
autorestart=true
stopsignal=KILL
这样的过程具有多个孩子的不能很好supervisord当它涉及到从 supervisorctl
阻止他们处理。所以,当我运行这个从supervisord并尝试从supervisorctl停止,只有顶级的过程就会被杀死,但不是实际的Java进程。
These kind of processes which have multiple childs are not well handled by supervisord when it comes to stopping them from supervisorctl
. So when I run this from the supervisord and try to stop it from supervisorctl, only the top level process gets killed but not the actual java process.
推荐答案
是由里克·汉龙II在这里遇到了同样的问题: HTTPS ://$c$crwall.com/p/4tcw7w
The same problem was encountered by Rick Hanlon II here: https://coderwall.com/p/4tcw7w
选项 stopasgroup = TRUE 应在supervisord程序段被设置为停止,不仅父进程,而且子进程。
Option stopasgroup=true should be set in the program section for supervisord to stop not only the parent process but also the child processes.
的例子被给定为:
[program:some_django]
command=python manage.py runserver
directory=/dir/to/app
stopasgroup=true
此外,心里有,你可能有一个旧包supervisord的不具有stopasgroup功能。
我试着树莓派这些Debian软件包:
Also, have in mind that you may have an older package of supervisord that does not have "stopasgroup" functionality. I tried these Debian packages on Raspberry Pi:
- supervisor_3.0a8不起作用。
- 如预期supervisor_3.0b2-1工作。
这篇关于supervisord停止子进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!