Ignore:
Timestamp:
07/30/08 18:25:59 (16 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks

    r8482 r9056  
    5050callistorcseq=callisto.rc
    5151callistorcnew=callisto_Dec04Jan05.rc
    52 # reason why calibration with standard callisto.rc fails
    53 #reason1="Pulse is too much to the right, cannot go beyond logain limits!"
    54 #.* == hi or lo
    55 reason1="Pulse is too much to the right, out of .*-gain range"
    56 #reason2="No entry for resource id '2[45]' found in"
    57 echo "reason1: "$reason1 >> $scriptlog 2>&1
    58 #echo "reason2: "$reason2 >> $scriptlog 2>&1
    5952
    60 # find files containing reason
    61 files=`find $datapath/callisto/ -name callisto*.log`
    62 if [ "$files" = "" ]
     53# query failed callistos (returncode 13) from DB
     54query="SELECT fSequenceFirst, fTelescopeNumber from SequenceProcessStatus where fReturnCode=13 and fProgramId=14"
     55primaries=( `sendquery` )
     56echo ${primaries[@]}
     57if [ ${#primaries[@]} -eq 0 ]
    6358then
    6459   echo "nothing to do -> exit"  >> $scriptlog 2>&1
    6560   finish >> $scriptlog 2>&1
    6661fi
     62num=`expr ${#primaries[@]} / 2 `
    6763
    6864cd $mars
    6965
    70 # make links for callisto.rc for which the callisto.log contains reason
    7166printprocesslog "INFO linking callisto.rc files"
    72 for file in $files
    73 do
    74 #   pulse=`cat $file | grep "$reason1\|$reason2"`
    75    pulse=`cat $file | grep "$reason1"`
    76    sequ=`echo $file | cut -d/ -f6`
    77    path=`dirname $file`
    78    callistorc=$path/$callistorcseq
     67for (( s=0 ; s < $num ; s++ ))
     68do
     69   sequence=${primaries[$s+$s]}
     70   telnum=${primaries[$s+$s+1]}
     71   callistorc=$datapath/callisto/`printf %08d $sequence | cut -c 0-4`/`printf %08d $sequence`/$callistorcseq
     72   if ! ls -l $callistorc 2>/dev/null | grep $callistorcnew >> $scriptlog 2>&1
     73   then
     74      printprocesslog "INFO linking $callistorcnew to $callistorc for sequ $sequence"
     75      # resetting the calibration
     76      echo "resetting the callisto for sequence $sequence" >> $scriptlog 2>&1
    7977
    80    if [ ! "$pulse" = "" ]
    81    then
    82       if ! ls -l $callistorc | grep $callistorcnew >> $scriptlog 2>&1
     78      query="UPDATE SequenceProcessStatus set fStartTime=NULL, fFailedTime=NULL, fProgramId=NULL, fReturnCode=NULL where fSequenceFirst=$sequence and fTelescopeNumber=$telnum"
     79      if ! sendquery >> $scriptlog 2>&1
    8380      then
    84          printprocesslog "INFO linking $callistorcnew to $callistorc for sequ $sequ"
    85          # resetting the calibration
    86          echo "resetting the callisto for sequence $sequ" >> $scriptlog 2>&1
    87          echo "  reason: $pulse" >> $scriptlog 2>&1
    88          resetlogpath=$logpath/resetcallisto
    89          makedir $resetlogpath >> $scriptlog 2>&1
    90          resetlog=$resetlogpath/reset-callisto-$sequ.log
    91 
    92          check1=`root -q -b $macrospath/resetcolumn.C+\("\"$column\""\,"\"$table\""\,"\"$sequ\""\,"\"$sequ\""\,kFALSE\) | tee $resetlog | intgrep`
    93          case $check1 in
    94             1)   echo " check1=$check1 -> everything ok, callisto has been reset " >> $scriptlog 2>&1
    95                  printprocesslog "INFO resetted calibration successfully for sequence $sequ"
    96                  ;;
    97             0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1
    98                  printprocesslog "WARN connection to DB failed"
    99                  check="no"
    100                  ;;
    101             *)   echo " check1=$check1 -> ERROR -> step could not be resetted -> continue " >> $scriptlog 2>&1
    102                  printprocesslog "ERROR resetcolumn.C failed for fCallisto for sequ $sequ"
    103                  continue
    104                  ;;
    105          esac
    106          #linking callisto.rc
    107          ln -vfs $setuppath/callisto/$callistorcnew $callistorc >> $scriptlog 2>&1
     81         printprocesslog "ERROR resetting calibration failed for sequence $sequence"
     82         continue
     83      else
     84         printprocesslog "INFO resetted calibration successfully for sequence $sequence"
    10885      fi
     86     
     87      #linking callisto.rc
     88      if ln -vfs $setuppath/callisto/$callistorcnew $callistorc >> $scriptlog 2>&1
     89      then
     90         printprocesslog "INFO link callisto.rc successfully for sequence $sequence"
     91      else
     92         printprocesslog "ERROR linking callisto.rc failed for sequence $sequence"
     93      fi
     94     
    10995   fi
    11096done
Note: See TracChangeset for help on using the changeset viewer.