Ok, I have a function that I need help with:
In a text file (PL_SENDEVENT), I have the following line:
CHANGE_STATUS INACTIVE
and another file (PL_JOBS) with the following lines:
TEST
TEST1
------------------------------------------------------------
What I'm trying to do is change the STATUS of TEST and TEST1 to the status that I specify in the file which is INACTIVE (or IN) in this case. I do not want the script to exit until both jobs have been verified that they are in an INACTIVE (IN) status. Not going well so far. As it stands, it exits successfully once it sets TEST to INACTIVE and doesn't even check TEST1. If the jobs are not in an INACTIVE status, I want it to check again until they both are. Any help would be greatly appreciated.
Thanks,
Jeff
--------------- code --------------------------------------
cat $PL_DIR/PL_SENDEVENT | while read event status
do
case $event in
CHANGE_STATUS)
cat $PL_DIR/PL_JOBNAME | while read job
do
sendevent -E CHANGE_STATUS -s ${status} -J ${job}
done
case $status in
INACTIVE) export ST=IN ;;
ON_HOLD) export ST=OH ;;
ON_ICE) export ST=OI ;;
TERMINATED) export ST=TE ;;
*) echo "Invalid Status!"; exit 1 ;;
esac
rc3=1
while (($rc3 > 0))
do
sleep 5
cat $PL_DIR/PL_JOBNAME | while read job
do
$AUTOSYS/bin/autorep -J ${job} -l0 | sed '1,4d' |
if [ `awk '{print $6}'` == ${ST} ]; then
echo "Status is set for ${job}!"
rc3=0
fi
done
done ;;