[Eug-lug] Shell script question

Quentin Hartman qhartman at gmail.com
Tue Aug 1 18:23:49 PDT 2006


On 8/1/06, Patrick R. Wade <prwade at oip.net> wrote:
> If i send a kill to the parent foo.sh process, the child foo.sh and find
> jobs will continue running.  This, from what i gather, is normal *NIX
> behavior.  My objective, however, is to ensure that foo.sh exits by a
> certain time, so i have an at job waiting to send it a kill.  Is there
> an idiom when writing the script to ensure that the kill it receives
> will kill the child processes as well?  Is there a completely different
> approach i need to take when the design requirement of termination by a
> time certain is added?

I seem to remember some bash convention that would allow the behavior
you are looking for, but I can't recall exactly what it is. I'm likely
dreaming. My suggestion would be to track the PIDs of the processes
you spawn, which I believe can be done by examining the !$ environment
variable after launching each process, and then killing them
explicitly. I've not had a need to do this myself though, so you'll
have to look elsewhere for specific recommendations on how precisely
this might be done.

-- 
-Regards-

-Quentin Hartman-


More information about the EUGLUG mailing list