#!/bin/csh -f
# qcheck
# checks to see if the qtran job has finished
# if it has found failures, qtran is aborted
#
set chk=1
set wtime = $1
while ( $chk == 1 )
   sleep $wtime
   /home/mseldre/bin/qtran/qtran_ofilter timeplt.dat trash | grep "failures captured" > /dev/null
   #Monitors the results of the output filter for the above string
   #and returns 0 in $status if the string is found, 1 otherwise.
   set chk=$status
   echo "qcheck executed: timeplt.dat checked for failure capture, status = "$chk
   /bin/rm -f trash
end
#
# failure was reached
echo "Final process time is:"
ps -ef |grep qtran.exe | grep -v grep
qkill
