How to check background tasks status, if fail report

Hi,

I have a requirement where I want to submit appx 100 jobs based on the files received. Assume today I received source file for 50 jobs, then I have submit a common script at 50 times.

This common script will take appx 1-2 mins to finish. I can' complete my parent script untill all the 50 submitted jobs completed.

How can I desing for this?

Thanks,

Create a list of process IDs as you create the asynchronous processes. Once you have submitted them all, use the wait command and supply all of the process IDs on the command line. Your script will block until they have all finished.

#!/usr/bin/env ksh

# probably works the same in bash
 for i in 1 2 3 4
do
   some-command &
   plist="$plist $!"   # add last process id
done


wait $plist     # wait for them all
echo all done