[BBLISA] To kill a process tree
Chaos Golubitsky
chaos at glassonion.org
Thu Apr 2 16:50:20 EDT 2009
On Thu, 02 Apr, 2009 at 16:43:47 -0400, Edward Ned Harvey wrote:
> I know if I simply "kill pid" then the process and all its children
> will die. But I don't want to kill them. I want to "kill -SIGTSTP pid"
> ... and this works as long as I name all the pids in the process tree.
> It does not cascade the signal to all the child processes if I only name
> the parent pid.
>
> Does anybody know a way to send a specific kill signal to a all the
> descendents of some specific pid?
Do you need a single command. I might do something along the lines of:
ps -e -o pid,ppid | awk '$2=<ppid #> {print $1}' | xargs kill -WHATEVER
Your mileage may vary by OS, but you get the idea --- list all commands
and their PPIDs, select only the PIDs matching the PPID you want, and
then pipe through xargs to do the kill.
Chaos
More information about the bblisa
mailing list