This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How do I kill a grandchild process from shell program?

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: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]