Gentoo Archives: gentoo-user

From: Jorge Almeida <jalmeida@××××××××××××.pt>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] kill a child and suicide
Date: Tue, 02 May 2006 16:49:40
Message-Id: Pine.LNX.4.64.0605021731450.17917@jmaa.math.ist.utl.pt
In Reply to: Re: [gentoo-user] [OT] kill a child and suicide by Zac Slade
1 On Tue, 2 May 2006, Zac Slade wrote:
2
3 > You can find the PID of the last backgrouned process using the bash variable
4 > $!
5 >
6 The child is not backgrounded!
7 > So something like:
8 > subprocess &
9 > $pid=$!
10 >
11 > Using trap along with maybe setting alarms should get you what you want.
12 >
13 Based on the suggestions of Uwe and Vladimir, I tried
14 trap 'pkill -TERM -P $$; kill -s TERM $$' TERM
15 <do something>
16 . /path/to/child.sh
17 <do something else>
18 Doesn't work, yet. Note that child.sh is a shell script that may execute
19 some other command (like rsync), so the "." by itself may not be enough.
20
21 Thanks everyone.
22
23
24 Jorge
25 --
26 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [OT] kill a child and suicide Hans-Werner Hilse <hilse@×××.de>