Possible Duplicate:
Best way to kill all child processes
I am running a script, which runs a java program in the background using the eval command.
eval <java java_program & >
While running the above command, I found that it creates a new child process. Now when I want to stop the process, in the script I tried with the command ‘$!’, which always gives me only parent process id. So kill -9 $! kills the parent process and leaves the child process still running in background.
Is there a way to find all the child processes associated with a process id and kill all the processes? Or what’s the efficient way of killing all the process?
You may try to use pstree using the parent pid
and for killing it may worth a visit for this:
Best way to kill all child processes