Gentoo Archives: gentoo-user

From: Iain Buchanan <iaindb@××××××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Paralell process in Bash
Date: Tue, 08 Nov 2005 06:50:09
Message-Id: 1131432405.12311.40.camel@orpheus
In Reply to: [gentoo-user] Paralell process in Bash by Rafael Barreto
1 On Tue, 2005-11-08 at 02:58 -0200, Rafael Barreto wrote:
2 > Is there any form to create a child process in a bash-script? I
3 > mean... I would like to have a script that use many background process
4 > to do some paralell things. I know that I could use & after a code
5 > block, but, in this way, when I kill the main script, their childs are
6 > alive yet. They don't die with their parent. Any form?
7
8 You should ask for what you really want, not what you think you have to
9 compromise with :)
10
11 Do I understand you correctly - you _want_ the child processes to die?
12
13 The child processes should indeed die, depending on how you kill the
14 script. If you send it a sigkill, this should be propogated to the
15 children. Unless they somehow detach themselves. sorry, don't know
16 much about signals...
17
18 If I read you wrong, and you _don't_ want the child processes to die,
19 you could use nohup: `nohup command args &` or quite cool would be
20 screen: `screen -dm command args` (no & required here). With screen,
21 you can then manually connect to each created screen and see the output
22 from each parallel task.
23
24 HTH,
25 --
26 Iain Buchanan <iaindb@××××××××××××.au>
27
28 --
29 gentoo-user@g.o mailing list