Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kill parent process and ALL child processes (if any)

Status
Not open for further replies.

grazinggoat

Programmer
Mar 12, 2008
41
0
0
US
Greetings Folks!

I have a script that kicks off multiple threads that I would like to make sure if say I do a cntrl-c (the script is force aborted) will not only kill the parent PID but any sub process?
any thoughts on how I can do this where the script knows its been terminated? I've been looking at links on signal traps but am not sure which way would be idea and clean. Any thoughts / suggestions?


thanks!
 
should have added.. I've read doing a kill -9 -1 ( if this would be the correct way to go?)
would do the trick but not sure how to incorporate this in the script using a proper signal
 
To get all child process, have a look here:
faq822-4603

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
If you have "[tt]pkill[/tt]", I believe that can kill a process tree.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top