Changeset 12933 for trunk/DataCheck
- Timestamp:
- 02/23/12 16:49:03 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/CheckRawData.sh
r12788 r12933 6 6 # options: 7 7 skipmd5sum="no" # fill md5 sums in any case 8 skipmd5sum="iffilled" # fill md5 sum only if they are not yet in db 8 skipmd5sum="iffilled" # fill md5 sum only if they are not yet in db # default 9 9 #skipmd5sum="yes" # do not fill md5 sums in any case 10 10 11 11 doupdate="yes" # update all entries 12 doupdate="no" # fill only entries which are not yet existing 12 #doupdate="no" # fill only entries which are not yet existing #default 13 13 14 14 source `dirname $0`/Sourcefile.sh … … 37 37 dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` ) 38 38 #dates=( `find /loc_data/zipraw/ -mindepth 3 -type d | sort | sed -e 's/\/loc_data\/zipraw\///g'` ) #all available dates in /loc_data/zipraw 39 #dates=( "2012/02/19" ) 39 40 40 41 # do check for rawfiles of these dates … … 62 63 do 63 64 printprocesslog "INFO checking file "$file 65 #echo "INFO checking file "$file 64 66 65 67 # raw and original file … … 115 117 116 118 # check if entry already exists 117 query3="SELECT f RunNumber FROM RunInfo WHERE Concat(fRunNumber, '_', LPAD(fFileNumber, 3, 0))='"$numberfromname"'"119 query3="SELECT fNight FROM RunInfo WHERE Concat(fNight, '_', LPAD(fRunID, 3, 0))='"$numberfromname"'" 118 120 printprocesslog "DEBUG check if entry already exists in DB. QUERY: "$query3 119 121 result3=`/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query3"` … … 131 133 # check if fits file is corrupted 132 134 numfitserrors=0 133 checkfitsfile=`fverify $rawfile | grep '0 error(s)'` 134 if [ "$checkfitsfile" == "" ] 135 then 136 numfitserrors=1 135 #checkfitsfile=`fverify $rawfile 2>/dev/null | grep '0 error(s)'` 136 numfitserrors=`fverify $rawfile 2>/dev/null | grep -o '[0-9][ ]error(s)' | grep -E -o '[0-9]'` 137 #if [ "$checkfitsfile" == "" ] 138 if [ $numfitserrors -gt 0 ] 139 then 140 printprocesslog "WARN "$rawfile" has "$numfitserrors" fitserror(s). " 141 #numfitserrors=1 137 142 fi 138 143 … … 158 163 # in the very beginning only drs-files were existing 159 164 # in the beginning the keywords DRSCALIB and STEP were not existing 165 numdrsfiles= 160 166 step= 161 167 drsfile=`echo $file | sed -e 's/fits/drs.fits/'` … … 168 174 then 169 175 printprocesslog "ERROR for file "$file" number of drsfiles ("$numdrsfiles") and information from header ("$drscalib") don't agree." 176 fi 177 else 178 if ! [ "$drscalib" == "F" ] 179 then 180 printprocesslog "WARN for file "$file" DRSCALIB is neither T nor F." 170 181 fi 171 182 fi … … 185 196 numped=`$factpath/fitsdump -h -t Events $file 2>/dev/null | grep 'NTRGPED' | grep -E -o '[0-9]+'` 186 197 numtime=`$factpath/fitsdump -h -t Events $file 2>/dev/null | grep 'NTRGTIM' | grep -E -o '[0-9]+'` 198 compiled=`$factpath/fitsdump -h -t Events $file 2>/dev/null | grep 'COMPILED' | grep -E -o "['][a-zA-Z]+[ ][ 12][0-9][ ]20[0-9][0-9][ ][0-2][0-9]:[0-5][0-9]:[0-5][0-9][']" | sed -e "s/'//g"` 199 if ! [ "$compiled" == "" ] 200 then 201 compiletime=`date +'%F %H:%M:%S' --date="${compiled}" ` 202 else 203 compiletime= 204 fi 205 revnum=`$factpath/fitsdump -h -t Events $file 2>/dev/null | grep 'REVISION' | grep -E -o "['][0-9]+[:]?[0-9]*[MSP]*[']" | sed -e "s/'//g"` 187 206 # in newest data start time is in DATE-OBS 188 207 # in older data start time is in TSTART … … 255 274 256 275 # check if entry has already checksums 257 query5="SELECT f RunNumber FROM RunInfo WHERE Concat(fRunNumber, '_', LPAD(fFileNumber, 3, 0))='"$numberfromname"'"276 query5="SELECT fNight FROM RunInfo WHERE Concat(fNight, '_', LPAD(fRunID, 3, 0))='"$numberfromname"'" 258 277 query5=$query5" AND NOT ISNULL(fMd5sumRaw) AND NOT ISNULL(fMd5sumRawZip)" 259 278 printprocesslog "DEBUG check if md5sums are alreay in DB. QUERY:"$query5 … … 287 306 then 288 307 query4="INSERT" 289 querymid=" f RunNumber="$runnumber", fFileNumber="$filenumberfromname", "308 querymid=" fNight="$runnumber", fRunID="$filenumberfromname", " 290 309 querystop= 291 310 else 292 311 query4="UPDATE" 293 312 querymid= 294 querystop=" WHERE f RunNumber="$runnumber" AND fFileNumber="$filenumberfromname313 querystop=" WHERE fNight="$runnumber" AND fRunID="$filenumberfromname 295 314 fi 296 315 query4=$query4" RunInfo SET "$querymid" fRunTypeKey="${result2[1]} … … 300 319 if [ "$numevents" != "" ] 301 320 then 302 query4=$query4", fNumEvents="$numevent 321 query4=$query4", fNumEvents="$numevents 303 322 fi 304 323 if [ "$roi" != "" ] … … 346 365 then 347 366 query4=$query4", fMd5sumRaw='"$md5sum"', fMd5sumRawZip='"$md5sumzip"'" 367 fi 368 if [ "$numdrsfiles" != "" ] 369 then 348 370 query4=$query4", fHasDrsFile="$numdrsfiles 349 371 fi … … 351 373 then 352 374 query4=$query4", fDrsStep="$step 375 fi 376 if [ "$compiletime" != "" ] 377 then 378 query4=$query4", fCompileTime='"$compiletime"'" 379 fi 380 if [ "$revnum" != "" ] 381 then 382 query4=$query4", fRevisionNumber='"$revnum"'" 353 383 fi 354 384 query4=$query4", fFitsFileErrors="$numfitserrors
Note:
See TracChangeset
for help on using the changeset viewer.