Operating System - HP-UX
1834391 Members
1463 Online
110066 Solutions
New Discussion

Re: Launching multiple processes

 
Angela Swyers_1
Frequent Advisor

Launching multiple processes

If I have an 'if' statement in a script, how do I get it to launch all the procedures that it would cause to spawn at the same time instead of waiting for one to complete before going to the next one.
1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor

Re: Launching multiple processes

if [ some condition ]
then
proc1 &
PROC1_PID=${!}
proc2 &
PROC2_PID=${!}
proc3 &
PROC3_PID=${!}
fi
wait # this will wait until all background tasks are completed
wait
# or you could
wait ${PROC2_PID} # parent is suspened until proc2 terminates
If it ain't broke, I can fix that.