Hi
I am running a loop which actually runs same script for different argument value passed to it.
while read repID
do
echo "Starting for $repID";
date;
perl process_report.pl $repID
done<${FILE_TO_READ}
However this runs in sequence.
I want the loop to not to wait for perl to complete before moving to next record.
So basically , it should call the perl script and move to next line of while loop. I want to run multiple instances of perl via while loop.
Is adding "&" will work fine ?
Yes this (&) should work.
Also, you could embrace it in brackets (perl process_report.pl $repID) .
This behaves the same (in this situation, there's a diffrence between the two i cannot explain), as long you dont want to fetch variables, but from the read, i'd guess you're writing the reports of that specific id...
while read line
do
echo "Executing for" $line
./test2.ksh $line &
done < "file23"
Executing for 60
[1] 20921
Executing for 50
[2] 20922
Executing for 80
[3] 20923
Executing for 20
starting sleep for 60 mins.
[4] 20924
Executing for 10
starting sleep for 50 mins.
[5] 20931
starting sleep for 80 mins.
Executing for 100
[6] 20934
Hope following example may help you, similarly you can too put all proccesses in background while calling your perl script use at last perl process_report.pl $repID & .
Thanks for the quick reply.
However if I have to implement a check to confirm if all the process have been completed then how can I do it ?
It is required to make sure that all parallel instances are completed before I change status to complete.