|
Home > Archive > Unix Programming > July 2005 > Killing my children's children
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Killing my children's children
|
|
| Derek Fountain 2005-07-29, 8:08 am |
| I do a fork and exec to fire off a long running script which in turn
starts a number of child processes of its own. Some time later things
have gone wrong and I need to tear down that set of processes. I have
the PID of the original process I started and I send it a SIGTERM. It
disappears, but it's children are all still sat there in the process table.
I don't have access to the source for child program I'm running, so I
can't modify it to clean up after itself. How do I deal with this?
I'm currently working on Linux, but I need a Solaris and AIX compatible
solution too.
| |
| Casper H.S. Dik 2005-07-29, 8:08 am |
| Derek Fountain <nomail@hursley.ibm.com> writes:
>I do a fork and exec to fire off a long running script which in turn
>starts a number of child processes of its own. Some time later things
>have gone wrong and I need to tear down that set of processes. I have
>the PID of the original process I started and I send it a SIGTERM. It
>disappears, but it's children are all still sat there in the process table.
Make sure the processes are in a single process group and then kill
the whole process group using:
kill -TERM -<groupnum>
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
| |
| Derek Fountain 2005-07-29, 8:08 am |
| > Make sure the processes are in a single process group and then kill
> the whole process group using:
>
> kill -TERM -<groupnum>
Yup, that works a treat. :o) Thanks!
|
|
|
|
|