Changeset 9355 for trunk/MagicSoft/Mars/datacenter/scripts/dbchk
- Timestamp:
- 02/19/09 21:22:19 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/MagicSoft/Mars/datacenter/scripts/dbchk ¶
r9131 r9355 46 46 program=dbchk 47 47 48 scriptlog=$runlogpath/$program-$datetime.log49 date >> $scriptlog 2>&150 51 48 getdbsetup 52 49 alias mymysql='mysql -s -u $us --password=$pw --host=$ho $db' 53 50 54 51 # check for crashed nights, runs, sequences and datasets 55 echo "Checking if something is crashed on nightly basis" >> $scriptlog 2>&1 52 printprocesslog "INFO Checking if something is crashed on nightly basis" 56 53 nights=`echo "SELECT fDate FROM SequenceBuildStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql` 57 54 if [ ! "$nights" = "" ] 58 55 then 59 56 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>&161 57 else 62 echo " Nothing found." >> $scriptlog 2>&158 printprocesslog "INFO Nothing found." 63 59 fi 64 60 65 echo "Checking if something is crashed on run basis" >> $scriptlog 2>&1 61 printprocesslog "INFO Checking if something is crashed on run basis" 66 62 cruns=`echo "SELECT fRunNumber FROM RunProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql` 67 63 if [ ! "$cruns" = "" ] 68 64 then 69 65 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>&171 66 else 72 echo " Nothing found." >> $scriptlog 2>&167 printprocesslog "INFO Nothing found." 73 68 fi 74 69 75 echo "Checking if something is crashed on sequence basis" >> $scriptlog 2>&1 70 printprocesslog "INFO Checking if something is crashed on sequence basis" 76 71 csequences=`echo "SELECT fSequenceFirst FROM SequenceProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql` 77 72 if [ ! "$csequences" = "" ] 78 73 then 79 74 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>&181 75 else 82 echo " Nothing found." >> $scriptlog 2>&176 printprocesslog "INFO Nothing found." 83 77 fi 84 78 85 echo "Checking if something is crashed on dataset basis" >> $scriptlog 2>&1 79 printprocesslog "INFO Checking if something is crashed on dataset basis" 86 80 cdatasets=`echo "SELECT fDataSetNumber FROM DataSetProcessStatus WHERE isnull(fFailedTime) and not isnull(fStartTime) and adddate(fStartTime, Interval 12 HOUR) < Now()" | mymysql` 87 81 if [ ! "$cdatasets" = "" ] 88 82 then 89 83 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>&191 84 else 92 echo " Nothing found." >> $scriptlog 2>&185 printprocesslog "INFO Nothing found." 93 86 fi 94 87 95 88 # CHECK 1 96 echo "Checking if all sequence files have a corresponding entry in Sequences" >> $scriptlog 2>&1 89 printprocesslog "INFO Checking if all sequence files have a corresponding entry in Sequences" 97 90 files=`find $sequpath -type f` 98 91 for file in $files … … 101 94 if [ "$sequence" = "" ] || [ "$sequence" = "$file" ] 102 95 then 103 echo "No sequence file: $file" >> $scriptlog 2>&1104 96 printprocesslog "ERROR No sequence file: $file" 105 97 continue … … 109 101 if ! [ "$sequence" = "$var" ] 110 102 then 111 echo "Sequence-File $sequence exist but it is not in Sequences." >> $scriptlog 2>&1112 103 printprocesslog "ERROR Sequence-File $sequence exists, but it is not in Sequences (DB)." 113 104 continue … … 116 107 117 108 # CHECK 1b (callisto) 118 echo "Checking if all sequences in ${datapath}/callisto have a corresponding sequence in Sequence" >> $scriptlog 2>&1 109 printprocesslog "INFO Checking if all sequences in ${datapath}/callisto have a corresponding sequence in Sequence" 119 110 dirs=`find ${datapath}/callisto -mindepth 2 -maxdepth 2 -type d` 120 111 for dir in $dirs … … 123 114 if [ "$sequence" = "" ] || [ "$sequence" = "$dir" ] 124 115 then 125 echo "Invalid directory: $dir" >> $scriptlog 2>&1126 116 printprocesslog "ERROR Invalid directory: $dir" 127 117 continue … … 131 121 if ! [ "$sequence" = "$var" ] 132 122 then 133 echo "$dir exists but no corresponding sequence in Sequences." >> $scriptlog 2>&1134 123 printprocesslog "ERROR $dir exists, but no corresponding sequence in Sequences (DB)." 135 124 continue … … 138 127 139 128 # CHECK 1c (star) 140 echo "Checking if all sequences in ${datapath}/star have a corresponding sequence in Sequence" >> $scriptlog 2>&1 129 printprocesslog "INFO Checking if all sequences in ${datapath}/star have a corresponding sequence in Sequence" 141 130 dirs=`find ${datapath}/star -mindepth 2 -type d` 142 131 for dir in $dirs … … 145 134 if [ "$sequence" = "" ] || [ "$sequence" = "$dir" ] 146 135 then 147 echo "Invalid directory: $dir" >> $scriptlog 2>&1148 136 printprocesslog "ERROR Invalid directory: $dir" 149 137 continue … … 153 141 if ! [ "$sequence" = "$var" ] 154 142 then 155 echo "$dir exists but no corresponding sequence in Sequences." >> $scriptlog 2>&1156 143 printprocesslog "ERROR $dir exists, but no corresponding sequence in Sequences (DB)." 157 144 continue … … 160 147 161 148 # CHECK 2 162 echo "Checking if all sequences in Sequences have a corresponding sequence files" >> $scriptlog 2>&1 149 printprocesslog "INFO Checking if all sequences in Sequences have a corresponding sequence files" 163 150 sequences=`echo SELECT fSequenceFirst FROM Sequences left join SequenceProcessStatus using (fSequenceFirst,fTelescopeNumber) where not isnull(fSequenceFileWritten) | mymysql` 164 151 for sequence in $sequences … … 167 154 if [ "$var" = "" ] 168 155 then 169 echo "Sequence-File for $sequence not found but in db." >> $scriptlog 2>&1170 156 printprocesslog "ERROR Sequence-File for $sequence not found but in DB." 171 157 fi … … 173 159 174 160 # CHECK 3 175 echo "Checking if all sequences from Sequences exist RunData" >> $scriptlog 2>&1 161 printprocesslog "INFO Checking if all sequences from Sequences exist RunData" 176 162 sequences=`echo SELECT fSequenceFirst FROM Sequences GROUP BY fSequenceFirst | mymysql` 177 163 for sequence in $sequences … … 180 166 if ! [ "$sequence" = "$res" ] 181 167 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)." 184 169 continue 185 170 fi … … 187 172 188 173 # CHECK 4 189 echo "Checking if all sequences from RunData exist in Sequences" >> $scriptlog 2>&1 174 printprocesslog "INFO Checking if all sequences from RunData exist in Sequences" 190 175 sequences=`echo SELECT fSequenceFirst FROM RunData WHERE not fSequenceFirst=0 GROUP BY fSequenceFirst | mymysql` 191 176 for sequence in $sequences … … 194 179 if ! [ "$sequence" = "$var" ] 195 180 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)." 198 182 continue 199 183 fi … … 201 185 202 186 # CHECK 5 203 echo "Checking if all sequences from RunData exist in SequenceProcessStatus" >> $scriptlog 2>&1 187 printprocesslog "INFO Checking if all sequences from RunData exist in SequenceProcessStatus" 204 188 sequences=`echo SELECT fSequenceFirst FROM RunData WHERE not fSequenceFirst=0 GROUP BY fSequenceFirst | mymysql` 205 189 for sequence in $sequences … … 208 192 if ! [ "$sequence" = "$var" ] 209 193 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)." 212 195 continue 213 196 fi 214 197 done 215 198 216 finish >> $scriptlog 2>&1199 finish
Note:
See TracChangeset
for help on using the changeset viewer.