Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appropriate signal to kill django development server

I'm trying to send a signal to the django development server to kill the parent and child processes.

$ 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

My understanding is that SIGINT should emulate pressing Ctrl-C in the terminal, but notice that SIGINT terminates the parent, 4189, but not the child, 4194. Same behavior for SIGKILL, SIGTERM, SIGSTOP. Using Ctrl-C from the terminal kills both as expected.

Is there a way to terminate the parent in a way that also kills the child without knowing the child's PID?

like image 899
Aaron Avatar asked Jan 19 '13 05:01

Aaron


2 Answers

kill -9 4189

Have a try, it should work!

like image 122
rrezyk Avatar answered Nov 16 '22 03:11

rrezyk


Put a dash in front of the process, this should kill the process group.

 kill -s SIGINT -4189
like image 23
jprosevear Avatar answered Nov 16 '22 01:11

jprosevear