1

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?

Community
  • 1
  • 1
Lolly
  • 34,250
  • 42
  • 115
  • 150

1 Answers1

0

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

Community
  • 1
  • 1
Hitman47
  • 421
  • 4
  • 8