Ignore:
Timestamp:
02/19/09 21:22:19 (16 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/MagicSoft/Mars/datacenter/scripts/dbchk

    r9131 r9355  
    4646program=dbchk
    4747
    48 scriptlog=$runlogpath/$program-$datetime.log
    49 date >> $scriptlog 2>&1
    50 
    5148getdbsetup
    5249alias mymysql='mysql -s -u $us --password=$pw --host=$ho $db'
    5350
    5451# check for crashed nights, runs, sequences and datasets
    55 echo "Checking if something is crashed on nightly basis" >> $scriptlog 2>&1
     52printprocesslog "INFO Checking if something is crashed on nightly basis"
    5653nights=`echo "SELECT fDate FROM SequenceBuildStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql`
    5754if [ ! "$nights" = "" ]
    5855then
    5956   printprocesslog "WARN For the following nights something seems to be crashed. Please check manually: $nights"
    60    echo "WARN For the following nights something  seems to be crashed. Please check manually: $nights" >> $scriptlog 2>&1
    6157else
    62    echo " Nothing found." >> $scriptlog 2>&1
     58   printprocesslog "INFO Nothing found."
    6359fi
    6460
    65 echo "Checking if something is crashed on run basis" >> $scriptlog 2>&1
     61printprocesslog "INFO Checking if something is crashed on run basis"
    6662cruns=`echo "SELECT fRunNumber FROM RunProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql`
    6763if [ ! "$cruns" = "" ]
    6864then
    6965   printprocesslog "WARN The following runs seem to be crashed. Please check manually: $cruns"
    70    echo "WARN The following runs seem to be crashed. Please check manually: $cruns" >> $scriptlog 2>&1
    7166else
    72    echo " Nothing found." >> $scriptlog 2>&1
     67   printprocesslog "INFO Nothing found."
    7368fi
    7469
    75 echo "Checking if something is crashed on sequence basis" >> $scriptlog 2>&1
     70printprocesslog "INFO Checking if something is crashed on sequence basis"
    7671csequences=`echo "SELECT fSequenceFirst FROM SequenceProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql`
    7772if [ ! "$csequences" = "" ]
    7873then
    7974   printprocesslog "WARN The following sequences seem to be crashed. Please check manually: $csequences"
    80    echo "WARN The following sequences seem to be crashed. Please check manually: $csequences" >> $scriptlog 2>&1
    8175else
    82    echo " Nothing found." >> $scriptlog 2>&1
     76   printprocesslog "INFO Nothing found."
    8377fi
    8478
    85 echo "Checking if something is crashed on dataset basis" >> $scriptlog 2>&1
     79printprocesslog "INFO Checking if something is crashed on dataset basis"
    8680cdatasets=`echo "SELECT fDataSetNumber FROM DataSetProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()"  | mymysql`
    8781if [ ! "$cdatasets" = "" ]
    8882then
    8983   printprocesslog "WARN The following datasets seem to be crashed. Please check manually: $cdatasets"
    90    echo "WARN The following datasets seem to be crashed. Please check manually: $cdatasets" >> $scriptlog 2>&1
    9184else
    92    echo " Nothing found." >> $scriptlog 2>&1
     85   printprocesslog "INFO Nothing found."
    9386fi
    9487
    9588# CHECK 1
    96 echo "Checking if all sequence files have a corresponding entry in Sequences" >> $scriptlog 2>&1
     89printprocesslog "INFO Checking if all sequence files have a corresponding entry in Sequences"
    9790files=`find $sequpath -type f`
    9891for file in $files
     
    10194   if [ "$sequence" = "" ] || [ "$sequence" = "$file" ]
    10295   then
    103       echo "No sequence file: $file" >> $scriptlog 2>&1
    10496      printprocesslog "ERROR No sequence file: $file"
    10597      continue
     
    109101   if ! [ "$sequence" = "$var" ]
    110102   then
    111       echo "Sequence-File $sequence exist but it is not in Sequences." >> $scriptlog 2>&1
    112103      printprocesslog "ERROR Sequence-File $sequence exists, but it is not in Sequences (DB)."
    113104      continue
     
    116107
    117108# CHECK 1b (callisto)
    118 echo "Checking if all sequences in ${datapath}/callisto have a corresponding sequence in Sequence" >> $scriptlog 2>&1
     109printprocesslog "INFO Checking if all sequences in ${datapath}/callisto have a corresponding sequence in Sequence"
    119110dirs=`find ${datapath}/callisto -mindepth 2 -maxdepth 2 -type d`
    120111for dir in $dirs
     
    123114   if [ "$sequence" = "" ] || [ "$sequence" = "$dir" ]
    124115   then
    125       echo "Invalid directory: $dir" >> $scriptlog 2>&1
    126116      printprocesslog "ERROR Invalid directory: $dir"
    127117      continue
     
    131121   if ! [ "$sequence" = "$var" ]
    132122   then
    133       echo "$dir exists but no corresponding sequence in Sequences." >> $scriptlog 2>&1
    134123      printprocesslog "ERROR $dir exists, but no corresponding sequence in Sequences (DB)."
    135124      continue
     
    138127
    139128# CHECK 1c (star)
    140 echo "Checking if all sequences in ${datapath}/star have a corresponding sequence in Sequence" >> $scriptlog 2>&1
     129printprocesslog "INFO Checking if all sequences in ${datapath}/star have a corresponding sequence in Sequence"
    141130dirs=`find ${datapath}/star -mindepth 2 -type d`
    142131for dir in $dirs
     
    145134   if [ "$sequence" = "" ] || [ "$sequence" = "$dir" ]
    146135   then
    147       echo "Invalid directory: $dir" >> $scriptlog 2>&1
    148136      printprocesslog "ERROR Invalid directory: $dir"
    149137      continue
     
    153141   if ! [ "$sequence" = "$var" ]
    154142   then
    155       echo "$dir exists but no corresponding sequence in Sequences." >> $scriptlog 2>&1
    156143      printprocesslog "ERROR $dir exists, but no corresponding sequence in Sequences (DB)."
    157144      continue
     
    160147
    161148# CHECK 2
    162 echo "Checking if all sequences in Sequences have a corresponding sequence files" >> $scriptlog 2>&1
     149printprocesslog "INFO Checking if all sequences in Sequences have a corresponding sequence files"
    163150sequences=`echo SELECT fSequenceFirst FROM Sequences left join SequenceProcessStatus using (fSequenceFirst,fTelescopeNumber) where not isnull(fSequenceFileWritten) | mymysql`
    164151for sequence in $sequences
     
    167154   if [ "$var" = "" ]
    168155   then
    169       echo "Sequence-File for $sequence not found but in db." >> $scriptlog 2>&1
    170156      printprocesslog "ERROR Sequence-File for $sequence not found but in DB."
    171157   fi
     
    173159
    174160# CHECK 3
    175 echo "Checking if all sequences from Sequences exist RunData" >> $scriptlog 2>&1
     161printprocesslog "INFO Checking if all sequences from Sequences exist RunData"
    176162sequences=`echo SELECT fSequenceFirst FROM Sequences GROUP BY fSequenceFirst | mymysql`
    177163for sequence in $sequences
     
    180166   if ! [ "$sequence" = "$res" ]
    181167   then
    182       echo "Sequence $sequence exists in Sequences but not in RunData." >> $scriptlog 2>&1
    183       printprocesslog "Sequence $sequence exists in Sequences but not in RunData (DB)."
     168      printprocesslog "ERROR Sequence $sequence exists in Sequences but not in RunData (DB)."
    184169      continue
    185170   fi
     
    187172
    188173# CHECK 4
    189 echo "Checking if all sequences from RunData exist in Sequences" >> $scriptlog 2>&1
     174printprocesslog "INFO Checking if all sequences from RunData exist in Sequences"
    190175sequences=`echo SELECT fSequenceFirst FROM RunData WHERE not fSequenceFirst=0 GROUP BY fSequenceFirst | mymysql`
    191176for sequence in $sequences
     
    194179   if ! [ "$sequence" = "$var" ]
    195180   then
    196       echo "Sequence $sequence exists in RunData but not in Sequences." >> $scriptlog 2>&1
    197       printprocesslog "Sequence $sequence exists in RunData but not in Sequences (DB)."
     181      printprocesslog "ERROR Sequence $sequence exists in RunData but not in Sequences (DB)."
    198182      continue
    199183   fi
     
    201185
    202186# CHECK 5
    203 echo "Checking if all sequences from RunData exist in SequenceProcessStatus" >> $scriptlog 2>&1
     187printprocesslog "INFO Checking if all sequences from RunData exist in SequenceProcessStatus"
    204188sequences=`echo SELECT fSequenceFirst FROM RunData WHERE not fSequenceFirst=0 GROUP BY fSequenceFirst | mymysql`
    205189for sequence in $sequences
     
    208192   if ! [ "$sequence" = "$var" ]
    209193   then
    210       echo "Sequence $sequence exists in RunData but not in SequenceProcessStatus." >> $scriptlog 2>&1
    211       printprocesslog "Sequence $sequence exists in RunData but not in SequenceProcessStatus (DB)."
     194      printprocesslog "ERROR Sequence $sequence exists in RunData but not in SequenceProcessStatus (DB)."
    212195      continue
    213196   fi
    214197done
    215198
    216 finish >> $scriptlog 2>&1
     199finish
Note: See TracChangeset for help on using the changeset viewer.