#! /usr/bin/sh set -xva #############################################################33 # NAME: DAVID MA # DATE: August 6, 2002 # Description: This is a support program that calls from # jobview_run. It outputs the parameters for # the web pake. # # ########################################################## # get date first # JobLName - job name with transfer_ instead of transfer/. # JobSMSName - Job name with full path, family and suite. # ctime - current universal time. # JobOutTime - job output file time. # JNATime - job no activity time in minutes. (ctime - JobOutTime) # JobZTime - job start time in universal time zone. # JRunTime - current job total run time in minutes. (ctime - JobZTime) # JDurTime - diff between Z time and L time . (JobZTime - JobLTime) # lAStartTime - job start time in history. # lASETime - job run time in history. # JobPer - Percent of current job against history run time. (JRunTime/lASETime) # ############################################################# # echo "STARTING THE JOBVIEW OUTPUT" typeset -R5 Pperhr typeset -Z2 JobZhr JobZmm JobRhr JobRmm JHShr JHSmm JHAhr JHAmm typeset -Z2 JNAhr JNAmm JPmm JOhr JOmm Jchr Jcmm Jthh Jtmm typeset -Z2 Jtdhh Jtdmm typeset -R10 JPhr # typeset -L50 JobName JobLName echo "MSG ==== $lAmsg" case ${JobStat} in 1) StatCode="I ";; 2) StatCode="P ";; 3) StatCode="S ";; 4) StatCode="R ";; 5) StatCode="CP";; 6) StatCode="RP";; 7) StatCode="RP";; 8) StatCode="VP";; 9) StatCode="C ";; 10) StatCode="RJ";; 11) StatCode="RV";; 12) StatCode="VA";; 13) StatCode="CA";; 14) StatCode="NR";; 15) StatCode="TX";; 16) StatCode="UE";; 17) StatCode="SE";; 18) StatCode="H ";; 19) StatCode="D ";; 20) StatCode="NQ";; *) StatCode="**";; esac ((sctime = $sctime -1440)) JobZTime=${JobZTime:-0} if [ $JobZTime -ge 1440 ] then ((JobZTime=$JobZTime-1440)) fi ((JobZhr=$JobZTime/60)) ((JobZmm=$JobZTime%60)) if [ ${JobStat} -eq 4 -o ${JobStat} -eq 9 -o ${JobStat} -eq 15 ] then JRunTime=${JRunTime:-0} JNATime=${JNATime:-0} if [ $JNATime -ge 1440 ] then ((JNATime=$JNATime-1440)) fi JobOutTime=${JobOutTime:-0} if [ $JobOutTime -ge 1440 ] then ((JobOutTime=$JobOutTime-1440)) fi lAStartTime=${lAStartTime:-0} lASETime=${lASETime:-0} if [ $lAStartTime -ge 1440 ] then ((lAStartTime = $lAStartTime - 1440)) ((lAStopTime = $lAStopTime - 1440)) fi if [ $lASETime -ge 1440 ] then ((lASETime=$lASETime-1440)) fi if [ $lAStartTime -ge 10000 ] then ((lAStartTime = $JobOutTime)) ((lAStopTime = $JobOutTime)) ((lASETime = $JobOutTime)) fi if [ $JobtmpRunTime -ge 1440 ] then ((JobtmpRunTime=$JobtmpRunTime-1440)) fi if [ ${ctime} -gt 1440 ] then ((kctime=$ctime-1440)) else ((kctime=$ctime)) fi ((JobtmpDurTime=$kctime - $JobtmpRunTime)) if [ $JobtmpDurTime -lt 0 ] then JobtmpDurTime=0 fi ((JOhr=$JobOutTime/60)) ((JOmm=$JobOutTime%60)) ((JobRhr=$JRunTime/60)) ((JobRmm=$JRunTime%60)) ((JHShr=$lAStartTime/60)) ((JHSmm=$lAStartTime%60)) ((JHAhr=$lASETime/60)) ((JHAmm=$lASETime%60)) ((JNAhr=$JNATime/60)) ((JNAmm=$JNATime%60)) ((Jthh=$JobtmpRunTime/60)) ((Jtmm=$JobtmpRunTime%60)) ((Jtdhh=$JobtmpDurTime/60)) ((Jtdmm=$JobtmpDurTime%60)) if [ $lASETime -le 0.0 ] then JPhr=0 JPmm=0 else ((dpper=${JRunTime}*10000/${lASETime})) ((dqper=$dpper)) ((dper=${dpper}/100)) ((JPhr=${dper})) ((JPmm=${dqper}-${dper}*100)) fi if [ ${lAStartTime} -lt 0.0 -o ${lASETime} -lt 0.0 ] then # -- No history start time echo "${JobLName} ${StatCode} 9999.99 ${JobRhr}:${JobRmm} ${JobZhr}:${JobZmm} ${JOhr}:${JOmm} XX:XX ${JNAhr}:${JNAmm} ${qmach} XX:XX ${lAmsg} ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} else # -- The job aborted last time if [ "$lAmsg" = "11440" ] then JHShr=00 JHSmm=00 JNAmm=00 JNAhr=00 echo "${JobLName} ${StatCode} ${JPhr}.${JPmm} ${JobRhr}:${JobRmm} ${JobZhr}:${JobZmm} ${JOhr}:${JOmm} ${JHShr}:${JHSmm} ${JNAhr}:${JNAmm} ${qmach} ${JHAhr}:${JHAmm} 11440 ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} else echo "${JobLName} ${StatCode} ${JPhr}.${JPmm} ${JobRhr}:${JobRmm} ${JobZhr}:${JobZmm} ${JOhr}:${JOmm} ${JHShr}:${JHSmm} ${JNAhr}:${JNAmm} ${qmach} ${JHAhr}:${JHAmm} ${lAmsg} ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} fi fi # elif [ ${JobStat} -eq 1 ] elif [ ${JobStat} -eq 1 -o ${JobStat} -eq 3 ] then JobtmpRunTime=${JobtmpRunTime:-0} if [ $JobtmpRunTime -ge 1440 ] then ((JobtmpRunTime=$JobtmpRunTime-1440)) fi ((Jthh=$JobtmpRunTime/60)) ((Jtmm=$JobtmpRunTime%60)) ((JobtmpDurTime=$kctime - $JobtmpRunTime)) if [ $JobtmpDurTime -le 0 ] then JobtmpDurTime=0 fi ((Jtdhh=$JobtmpDurTime/60)) ((Jtdmm=$JobtmpDurTime%60)) if [ $lAmsg -gt 20000 ] then echo "${JobLName} ${StatCode} 9999.98 00:00 ${JobZhr}:${JobZmm} 00:00 00:00 00:00 $qmach 00:00 ${lAmsg} ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} else echo "${JobLName} ${StatCode} 9999.98 00:00 ${JobZhr}:${JobZmm} 00:00 00:00 00:00 $qmach 00:00 ${lAmsg} ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} fi else JobtmpRunTime=${JobtmpRunTime:-0} if [ $JobtmpRunTime -ge 1440 ] then ((JobtmpRunTime=$JobtmpRunTime-1440)) fi ((Jthh=$JobtmpRunTime/60)) ((Jtmm=$JobtmpRunTime%60)) ((JobtmpDurTime=$kctime - $JobtmpRunTime)) if [ $JobtmpDurTime -le 0 ] then JobtmpDurTime=0 fi ((Jtdhh=$JobtmpDurTime/60)) ((Jtdmm=$JobtmpDurTime%60)) if [ ${JobStat} -eq 15 -o ${JobStat} -eq 9 -o ${JobStat} -eq 2 ] then echo "${JobLName} ${StatCode} 9999.98 00:00 ${JobZhr}:${JobZmm} 00:00 00:00 00:00 $qmach 00:00 9999 ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} else echo "${JobLName} ${StatCode} 9999.97 00:00 ${JobZhr}:${JobZmm} 00:00 00:00 00:00 $qmach XX:XX 9999 ${Jthh}:${Jtmm} ${Jtdhh}:${Jtdmm}" >> ${ddat} fi fi echo "$JobLName ===> $JobZTime $JRunTime $lAStartTime $lASETime $ctime $JobOutTime $JNATime $JobPer $JobSMSName" >> ttai