How do I kill a grandchild process from shell program?
Matthew Woehlke
mwoehlke@tibco.com
Tue Oct 24 20:56:00 GMT 2006
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.
>
> Questions:
> 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).
--
Matthew
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
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list