This is the mail archive of the
mailing list for the Cygwin project.
Re: How do I kill a grandchild process from shell program?
- From: Matthew Woehlke <mwoehlke at tibco dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 24 Oct 2006 14:56:17 -0500
- Subject: Re: How do I kill a grandchild process from shell program?
- References: <firstname.lastname@example.org>
Jim Seymour wrote:
I have two shell programs - one that launches the other in the
background. The background one runs a utility program that (under
normal circumstances) will shut down gracefully.
However, if things don't work fine, the background process sticks around
to plague me later.
I'd like to end my main script by killing the background process (if
it's still around), but I'm having a helluva time figuring out HOW.
I can use "kill $!" in the main script, but that only kills the
background bash process, leaving the utility program running.
1) Is "kill %?name" supposed to work in this environment?
2) Is there a simple way to kill a process along with its children?
'kill -SIGHUP <process>'? Or if the child is a bash script, you might be
able to re-write it to trap a signal (e.g. SIGUSR1) that instructs the
child to kill /its/ child (the assumption being that the child knows its
own child's PID).
Only Joe suffers from schizophrenia. The rest of us enjoy it.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html