Re: [gentoo-user] [OT] kill a child and suicide

2006-05-04 Thread Jorge Almeida
On Wed, 3 May 2006, Zac Slade wrote: On Wednesday 03 May 2006 16:04, Jorge Almeida wrote: But I won't be able to use svc to interact with the child. That's why I feel I must reformulate the whole setup. If you need deeper interaction with a child process then you might need to look outside

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Christopher Fisk
On Tue, 2 May 2006, Jorge Almeida wrote: parent.sh #!/bin/bash do something /path/to/child.sh do something else It's just bash scripting, just tell bash to exec child.sh in the background. /path/to/child.sh Christopher Fisk -- Stewie Griffin: Mother,

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Jorge Almeida
On Wed, 3 May 2006, Christopher Fisk wrote: It's just bash scripting, just tell bash to exec child.sh in the background. /path/to/child.sh Nope. I need the child in the foreground, so that its output and stderr goes to multilog. Thanks, Jorge Almeida -- gentoo-user@gentoo.org mailing

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Boyd Stephen Smith Jr.
On Wednesday 03 May 2006 11:25, Jorge Almeida [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] [OT] kill a child and suicide': On Wed, 3 May 2006, Christopher Fisk wrote: It's just bash scripting, just tell bash to exec child.sh in the background. /path/to/child.sh Nope. I need

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Jorge Almeida
On Wed, 3 May 2006, Boyd Stephen Smith Jr. wrote: Putting something in the background doesn't change what it's std(in|out| err) are attached to. They will still go to the [pt]ty like normal. If Right, my mistake. Still, the parent script will exit sucessfuly, and then how can the

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Hans-Werner Hilse
Hi, On Wed, 3 May 2006 20:38:49 +0100 (WEST) Jorge Almeida [EMAIL PROTECTED] wrote: On Wed, 3 May 2006, Boyd Stephen Smith Jr. wrote: Putting something in the background doesn't change what it's std(in|out| err) are attached to. They will still go to the [pt]ty like normal. If Right,

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Jorge Almeida
On Wed, 3 May 2006, Hans-Werner Hilse wrote: Signals are the only way (or you have a parent died logic inside the child process). And this will always open a racing condition when But I won't be able to use svc to interact with the child. That's why I feel I must reformulate the whole setup.

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-03 Thread Zac Slade
On Wednesday 03 May 2006 16:04, Jorge Almeida wrote: On Wed, 3 May 2006, Hans-Werner Hilse wrote: Signals are the only way (or you have a parent died logic inside the child process). And this will always open a racing condition when But I won't be able to use svc to interact with the child.

[gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Jorge Almeida
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

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Etaoin Shrdlu
On Tuesday 02 May 2006 14:40, Jorge Almeida wrote: 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

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Jorge Almeida
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:

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Vladimir G. Ivanovic
pkill has a -g option to send a signal to a process group. --- Vladimir On Tue, 2006-05-02 at 14:48 +0100, 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

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Zac Slade
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

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Jorge Almeida
On Tue, 2 May 2006, Zac Slade wrote: You can find the PID of the last backgrouned process using the bash variable $! The child is not backgrounded! So something like: subprocess $pid=$! Using trap along with maybe setting alarms should get you what you want. Based on the suggestions of

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Hans-Werner Hilse
Hi, On Tue, 2 May 2006 17:42:26 +0100 (WEST) Jorge Almeida [EMAIL PROTECTED] wrote: On Tue, 2 May 2006, Zac Slade wrote: You can find the PID of the last backgrouned process using the bash variable $! The child is not backgrounded! So something like: subprocess $pid=$! Using

Re: [gentoo-user] [OT] kill a child and suicide

2006-05-02 Thread Jorge Almeida
On Tue, 2 May 2006, Hans-Werner Hilse wrote: Based on the suggestions of Uwe and Vladimir, I tried trap 'pkill -TERM -P $$; kill -s TERM $$' TERM do something . /path/to/child.sh do something else Doesn't work, yet. Note that child.sh is a shell script that may