in my script i am getting a process id(parent/main)
for that main process id 3-4 several sub processes are running in linux terminal
My requirement is from that processid killing all sub process and sub processes also.
i have tried
import os
pid = parent process id
from subprocess import call
call(["pkill", "-TERM","-P", str(pid)])
But not successfull at doing that.
Also tried
os.system('kill -9 ' + pid) # only parent is getting killed subpid are still running.
Please suggest something like list out all sub process by their main process id.then in loop how to kill those and then the parent process.
kill process and its sub/co-processes by getting their parent pid by python script
Sadly this was not helpful in my case.