(file) Return to checkgates.csh CVS log (file) (dir) Up to [Development] / JSOC / proj / workflow

File: [Development] / JSOC / proj / workflow / checkgates.csh (download) / (as text)
Revision: 1.1, Sun Jan 2 22:14:11 2011 UTC (11 years, 11 months ago) by phil
Branch: MAIN
CVS Tags: Ver_LATEST, Ver_9-5, Ver_9-41, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, Ver_8-8, Ver_8-7, Ver_8-6, Ver_8-5, Ver_8-4, Ver_8-3, Ver_8-2, Ver_8-12, Ver_8-11, Ver_8-10, Ver_8-1, Ver_8-0, Ver_7-1, Ver_7-0, Ver_6-4, Ver_6-3, Ver_6-2, Ver_6-1, Ver_6-0, Ver_5-14, Ver_5-13, HEAD
Initial commit, copied from ~phil/workflow

#! /bin/csh -f
# monitor program

set keep_watching = 1
set thiscmd = `basename $0`
if ($thiscmd == checkgates.csh) set keep_watching = 0

if ($#argv >= 1) then
     set LIST = "*"$1"*"
else
     set LIST = "*"
endif
# echo "$LIST"

if ($?WORKFLOW_ROOT) then
  set WFDIR = $WORKFLOW_DATA
  set WFCODE = $WORKFLOW_ROOT
else
  echo Need WORKFLOW_ROOT variable to be set.
  exit 1
endif

set nonomatch


while (1)

   cd $WFDIR

   while (-e GATEKEEPERBUSY)
      echo -n '.'
      sleep 1
   end

   clear
   set nowtxt = `date -u +%Y.%m.%d_%H:%M:%S`"_UTC" 
   echo " "; echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
   echo " "; echo " "; echo " "; echo " "
   echo -n "TIME = $nowtxt, LAST_NEWICKET = "
   cat LAST_NEWTICKET

   cd $WFDIR/gates
   foreach gate ( $LIST )
        echo " "
        cd $WFDIR/gates/$gate
        set gatestatus = `cat gatestatus`
        if ($gatestatus == "HOLD") then
            echo -n "GATE $gate is on HOLD, skip"
            cd ..
            continue
        endif
        echo -n "GATE $gate" "   for "
        cat product
        set SEQUENCE = `cat sequence_number`
        set NEXTUPDATE = `cat nextupdate`
        set LOW = `cat low`
        set HIGH = `cat high`
        echo  "     Last ticketID =  $SEQUENCE,   nextupdate =  $NEXTUPDATE", low = $LOW, high = $HIGH
        echo -n "     NEW TICKETS: "
        cd new_tickets
        set ticketlist = `/bin/ls`
        set ntickets = $#ticketlist
        if ($ntickets) then
    	      foreach ticket ($ticketlist)
                  echo -n "$ticket "
    	      end  #new
        endif
        echo  " "
        cd ../active_tickets
        echo "     ACTIVE TICKETS: "
        set ticketlist = `/bin/ls`
        set ntickets = $#ticketlist
        if ($ntickets) then
              foreach ticket ($ticketlist)
                   set STATUS = `grep STATUS $ticket`
    		   set WANTLOW = `grep WANTLOW $ticket`
    		   set WANTHIGH = `grep WANTHIGH $ticket`
    		   set ACTION = `grep ACTION $ticket`
                   set TASKID = `grep TASKID $ticket`
                   echo "         $ticket"": $STATUS, $WANTLOW, $WANTHIGH, $ACTION, $TASKID"
    	      end # active
        endif
        cd ..
   end
   if ($keep_watching) then
       sleep 10
   else
       break
   endif
end

Karen Tian
Powered by
ViewCVS 0.9.4