适当的信号杀死django开发服务器

Aar*_*ron 9 linux django process

我正在尝试向django开发服务器发送信号以杀死父进程和子进程.

$ python manage.py runserver
Validating models...

0 errors found
Django version 1.4.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

$ ps axf
26077 pts/12   Ss     0:00  \_ -bash
 4189 pts/12   S+     0:00  |   \_ python manage.py runserver
 4194 pts/12   Sl+    0:00  |       \_ /myproject/.virtualenv/bin/python manage.py runserver

$ kill -s SIGINT 4189
$ ps axf
4194 pts/12   Sl     0:00 /sh/myproject/.virtualenv/bin/python manage.py runserver
Run Code Online (Sandbox Code Playgroud)

我的理解是SIGINT应该模仿终端中的Ctrl-C,但请注意SIGINT终止父项4189,而不是子项4194. SIGKILL,SIGTERM,SIGSTOP的行为相同.使用终端上的Ctrl-C会按预期方式终止.

有没有办法以一种在不知道孩子的PID的情况下杀死孩子的方式终止父母?

rre*_*zyk 9

kill -9 4189

试一试,它应该工作!


jpr*_*ear 7

在流程前放一个破折号,这应该会杀死进程组.

 kill -s SIGINT -4189
Run Code Online (Sandbox Code Playgroud)