Hello,
I wish to run parallel process forked from one script.
Currently I doing is submit them in background.
For example:
---------------------------------------------------------------
#!/usr/bin/ksh
process1 &
process2 &
process3 &
.....
.....
#here I check for completion of all process success.
#each process writes its status to a file
while true
do
# code to check success
done
---------------------------------------------------------------
Is there a better way to execute jobs in paralle?
If yes please advise.
Thanks,
Rishi
Assuming that by running separate processes you get better throughput, this is a fine way to proceed.
What about something like...
#!/bin/ksh
./a.sh &
pid_a=$!
./b.sh &
pid_b=$!
./c.sh &
pid_c=$!
wait $pid_a
echo "a.sh returned $?"
wait $pid_b
echo "b.sh returned $?"
wait $pid_c
echo "c.sh returned $?"
-Om
it can be good replacement if I was not seeking parallel execution...
I believe with wait the execution will become sequential...and waiting for all the process finishing starting from one...
my requirement is suppose one process is finished I need to start some processing on data prepared by tht process....
in this case say process a takes largest time then I need to wait till process a to finish before I begin for processing of b,c...z though they have already finished...
Rishi
RishiPahuja -
We use the control file method just like you do. Sorry for any confusion