IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2023, 2:43:59 PM (3 years ago)
Author:
eugene
Message:

cleanup logging and automatic advance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/eam/rawfix.20230221/src/advance.rawfix.sh

    r42430 r42440  
    22
    33if ($#argv < 1) then
    4   echo "USAGE: advance.rawfix.sh all"
     4  echo "USAGE: advance.rawfix.sh all (Nmax)"
    55  echo "USAGE: advance.rawfix.sh night (YYYYMMDD)"
    66  exit 2
     
    99set mode = $1
    1010
     11## include a max number of active programs
    1112if ($mode == "all") then
     13  if ($#argv != 2) then
     14    echo "USAGE: advance.rawfix.sh all (Nmax)"
     15    exit 2
     16  endif
     17
     18  set nMax = $2
     19  set nActive  = 0
     20  set nAdvance = 0
    1221  set nights = `./check.rawfix.sh all | awk '(NR > 1){print $1}'`
    1322  foreach f ($nights)
    14     echo -n "$f "
    1523    ./advance.rawfix.sh night $f
     24    set myResult = $status
     25    if ($myResult == 1) continue
     26    if ($myResult == 2) continue
     27    if ($myResult == 3) continue
     28    if ($myResult == 4) then
     29      @ nActive ++
     30    endif
     31    if ($myResult == 5) then
     32      @ nActive ++
     33      @ nAdvance ++
     34    endif
     35    if ($nActive >= $nMax) then
     36      echo "advance $nAdvance nights, total of $nActive active nights"
     37      exit 0
     38    endif
    1639  end
     40  echo "advance $nAdvance nights, total of $nActive active nights"
    1741  exit 0
    1842endif
    1943
     44# advance STAGE0.done to STAGE1.new
     45# if already in STAGEx.new, return 4
     46# if setting to STAGEx.new, return 5
     47# otherwise, return 3
    2048if ($mode == "night") then
    2149  if ($#argv != 2) then
     
    2957
    3058  set tgtstate = "NONE"
     59  if ($mystate == "new")             set tgtstate = "ckchip.new"
    3160  if ($mystate == "ckchip.done")     set tgtstate = "fixchip.new"
    3261  if ($mystate == "fixchip.done")    set tgtstate = "md5sum.new"   
     
    3766  if ($mystate == "md5chk_s2.done")  set tgtstate = "fixchip_s3.new"   
    3867  if ($mystate == "fixchip_s3.done") set tgtstate = "ckchip_s3.new"   
     68  if ($mystate == "ckchip_s3.done")  set tgtstate = "DONE"
    3969
    40   if ($tgtstate == "NONE") then
    41     echo "nothing to advance"
    42     exit 0
    43   endif
     70  if ($mystate == "ckchip.new")      set tgtstate = "ACTIVE"
     71  if ($mystate == "fixchip.new")     set tgtstate = "ACTIVE"
     72  if ($mystate == "md5sum.new")      set tgtstate = "ACTIVE"
     73  if ($mystate == "md5chk.new")      set tgtstate = "ACTIVE"
     74  if ($mystate == "fixchip_s2.new")  set tgtstate = "ACTIVE"
     75  if ($mystate == "md5sum_s2.new")   set tgtstate = "ACTIVE"
     76  if ($mystate == "md5chk_s2.new")   set tgtstate = "ACTIVE"
     77  if ($mystate == "fixchip_s3.new")  set tgtstate = "ACTIVE"
     78  if ($mystate == "ckchip_s3.new")   set tgtstate = "ACTIVE"
    4479
     80  echo "$night : $mystate : $tgtstate"
     81
     82  # do not set these two states
     83  if ($tgtstate == "NONE") exit 3
     84  if ($tgtstate == "ACTIVE") exit 4
     85
     86  # only set these states
    4587  ./update.rawfix.sh $night $tgtstate
    46   exit 0
     88
     89  if ($tgtstate == "DONE") exit 1
     90  exit 5
    4791endif
    4892
    49 echo "ERROR: unknown mode: $mode
     93echo "ERROR: unknown mode: $mode"
    5094exit 2
Note: See TracChangeset for help on using the changeset viewer.