On Tuesday 02 May 2006 08:48, Jorge Almeida wrote:
> On Tue, 2 May 2006, Etaoin Shrdlu wrote:
> > I think (untested) you can do something like
> >
> > trap 'kill <pid of child>' TERM
> >
> > at then beginning of parent.sh. This way, when the parent recives TERM it
> > in turn sends a TERM to the child. If you want the parent to terminate,
> > add the exit command as well:
> >
> > trap 'kill <pid of child>; exit 1' TERM
>
> But how to find out the PID of child? What would be convenient is a way
> to send signals "recursively" to a process and its children.
> Maybe I'm trying to solve a problem with wrong tools...
> Thanks,
You can find the PID of the last backgrouned process using the bash variable 
$!

So something like:
subprocess &
$pid=$!

Using trap along with maybe setting alarms should get you what you want.
-- 
Zac Slade
[EMAIL PROTECTED]
ICQ:1415282 YM:krakrjak AIM:ttyp99
-- 
gentoo-user@gentoo.org mailing list

Reply via email to