Can anybody help please.
I am trying to right a script which will loop until a certain action has been performed. For example i current have two batch jobs i would like to put into a wait status. Batch Jobs A and B . The script i am trying to get to work is below.
jobs="A B"
COUNT=0
while [ $COUNT -lt 2 ]
do
for batch in $jobs
do
echo "Holding suite" ( I have a line here that kicks off a holding script)
echo "Get status" (I have a line here that gets the status of the batch job)
if [ $status = "Wait" ]
then
COUNT=\`expr $COUNT \+ 1\`
fi
done
done
Now this seems to almost work except if one batch job for example B. If that finishes first it will add one start the loop again see that A has not finished go through B again and add another one making the COUNT to equal 2 stopping the loop. I need a loop that will keep looping just A until that has gone to a Wait state and then move onto B.
I know this is slightly confusing but if anyone could help it would be apprectiated as it is annoying me now.