* Jorge Almeida <[EMAIL PROTECTED]> [02/05/06 16:00]:
> parent.sh
>       #!/bin/bash
>       <do something>
>       /path/to/child.sh
>       <do something else>
> 
> When parent.sh receives a TERM signal, I would like child.sh to receive
> TERM also, and then parent.sh receive TERM.
> The <do something else> part is why I can't use "exec /path/to/child.sh". Is 
> there some way to achieve this?

You can use 'kill 0' to send a signal to your own process group. 
Something like this:

#!/bin/sh
trap 'kill 0;exit' TERM
echo "before"
( sleep 30; echo inside )
echo "after"

Note that you can also send the signal with the negative of the pid, and 
then it goes to the whole process group.

Moshe

> 
> -- 
> Jorge Almeida
> -- 
> [email protected] mailing list
> 

-- 
I love deadlines. I like the whooshing sound they make as they fly by. 
                                        -- Douglas Adams
    
    Moshe Kaminsky <[EMAIL PROTECTED]>
    Home: 08-9456841

Attachment: pgpu8dRCB1VJW.pgp
Description: PGP signature

Reply via email to