Bdfy Bdfy - 2 years ago 129
Python Question

how to kill process and child processes from python?

for example from bash:

kill -9 -PID

os.kill(pid, signal.SIGKILL)
kill only parent process.

Answer Source

When you pass a negative PID to kill, it actually sends the signal to the process group by that (absolute) number. You do the equivalent with os.killpg() in Python.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download