Re: Forking and subshells - Keeping the parent active
- From: Frank Ranner <franner@xxxxxxxxxxxxxxxxxxxx>
- Date: 29 Jun 2008 05:56:05 GMT
On Sat, 28 Jun 2008 21:30:51 -0500, Bob Bob wrote:
I am finding this hard to find information on..
Running a bash script, that is setup to fork a subshell (also a bash
script)
Want the parent to keep running while the child is doing its processing.
There is a trap in the parent script to make it sleep if the child runs
over time. The communication of this event is a simple "while -f
filename" in the parent that is setup by a "touch filename" at the start
of the child script and a subsequent "rm -f filename" at the end.
Not rocket science or anything!
Within the parent script the fork is simply;
sh childscript
Do:
sh childscript &
to put the childscript into the background. The shell will give you the
job number and PID of the backgrounded task. After the loop you can use
'wait' which will stall the parent script until ALL child instances
finish.
example:
for p in 1 2 3 4 5 6 7 8 9; do
sh childscript $p &
done
wait
echo All done
regards,
Frank Ranner
.
- Follow-Ups:
- Re: Forking and subshells - Keeping the parent active
- From: Bob Bob
- Re: Forking and subshells - Keeping the parent active
- References:
- Forking and subshells - Keeping the parent active
- From: Bob Bob
- Forking and subshells - Keeping the parent active
- Prev by Date: Re: Forking and subshells - Keeping the parent active
- Next by Date: Re: Somebody still running SUSE 9.2?
- Previous by thread: Re: Forking and subshells - Keeping the parent active
- Next by thread: Re: Forking and subshells - Keeping the parent active
- Index(es):
Relevant Pages
|