Changeset 12972 for trunk/DataCheck
- Timestamp:
- 02/29/12 13:16:26 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/CheckRawData.sh
r12933 r12972 1 1 #!/bin/bash 2 3 # this script has been written to run on La Palma on the machine data 4 # i.e. paths are only working on this machine 5 # the script starts from the zipped files 6 # this causes a delay until files are in the database 7 # because they have to be rsynced and zipped first (see RsyncRawData.sh, ZipRawData.sh) 2 8 3 9 # missing … … 10 16 11 17 doupdate="yes" # update all entries 12 #doupdate="no" # fill only entries which are not yet existing #default18 doupdate="no" # fill only entries which are not yet existing #default 13 19 14 20 source `dirname $0`/Sourcefile.sh … … 31 37 then 32 38 printprocesslog "ERROR "$factpath"/fitsdump is not available." 39 finish 40 fi 41 42 # check if paths are available 43 if ! ls /daq/raw >/dev/null 2>&1 44 then 45 printprocesslog "ERROR /daq/raw is not available." 46 finish 47 fi 48 if ! ls /loc_data/raw >/dev/null 2>&1 49 then 50 printprocesslog "ERROR /loc_data/raw is not available." 51 finish 52 fi 53 if ! ls /loc_data/zipraw >/dev/null 2>&1 54 then 55 printprocesslog "ERROR /loc_data/zipraw is not available." 33 56 finish 34 57 fi … … 117 140 118 141 # check if entry already exists 119 query3="SELECT fNight FROM RunInfo WHERE Concat(fNight, '_', LPAD(fRunID, 3, 0))='"$numberfromname"'" 120 printprocesslog "DEBUG check if entry already exists in DB. QUERY: "$query3 121 result3=`/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query3"` 142 query="SELECT fNight FROM RunInfo WHERE Concat(fNight, '_', LPAD(fRunID, 3, 0))='"$numberfromname"'" 143 printprocesslog "DEBUG check if entry already exists in DB. QUERY: "$query 144 #result3=`/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query3"` 145 result3=`sendquery` 122 146 123 147 # only proceed with file … … 264 288 fi 265 289 # get runtype 266 query2="SELECT fRunTypeKEY FROM RunType WHERE fRunTypeName='"$runtype"'" 267 printprocesslog "DEBUG get run type from DB. QUERY:"$query2 268 result2=( `/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query2"` ) 290 query="SELECT fRunTypeKEY FROM RunType WHERE fRunTypeName='"$runtype"'" 291 printprocesslog "DEBUG get run type from DB. QUERY:"$query 292 #result2=( `/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query2"` ) 293 result2=( `sendquery` ) 269 294 if [ ${#result2} -eq 0 ] 270 295 then … … 274 299 275 300 # check if entry has already checksums 276 query5="SELECT fNight FROM RunInfo WHERE Concat(fNight, '_', LPAD(fRunID, 3, 0))='"$numberfromname"'" 277 query5=$query5" AND NOT ISNULL(fMd5sumRaw) AND NOT ISNULL(fMd5sumRawZip)" 278 printprocesslog "DEBUG check if md5sums are alreay in DB. QUERY:"$query5 279 result5=`/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query5"` 301 query="SELECT fNight FROM RunInfo WHERE Concat(fNight, '_', LPAD(fRunID, 3, 0))='"$numberfromname"'" 302 query=$query" AND NOT ISNULL(fMd5sumRaw) AND NOT ISNULL(fMd5sumRawZip)" 303 printprocesslog "DEBUG check if md5sums are alreay in DB. QUERY:"$query 304 #result5=`/usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query5"` 305 result5=`sendquery` 280 306 281 307 # get md5sums of raw and zip file … … 305 331 if [ "$result3" == "" ] 306 332 then 307 query 4="INSERT"333 query="INSERT" 308 334 querymid=" fNight="$runnumber", fRunID="$filenumberfromname", " 309 335 querystop= 310 336 else 311 query 4="UPDATE"337 query="UPDATE" 312 338 querymid= 313 339 querystop=" WHERE fNight="$runnumber" AND fRunID="$filenumberfromname 314 340 fi 315 query 4=$query4" RunInfo SET "$querymid" fRunTypeKey="${result2[1]}341 query=$query" RunInfo SET "$querymid" fRunTypeKey="${result2[0]} 316 342 if [ $numfitserrors -eq 0 ] 317 343 then 318 query 4=$query4", fRunStart='"$runstart"', fRunStop='"$runstop"'"344 query=$query", fRunStart='"$runstart"', fRunStop='"$runstop"'" 319 345 if [ "$numevents" != "" ] 320 346 then 321 query 4=$query4", fNumEvents="$numevents347 query=$query", fNumEvents="$numevents 322 348 fi 323 349 if [ "$roi" != "" ] 324 350 then 325 query 4=$query4", fROI="$roi351 query=$query", fROI="$roi 326 352 fi 327 353 if [ "$roitm" != "" ] 328 354 then 329 query 4=$query4", fROITimeMarker="$roitm355 query=$query", fROITimeMarker="$roitm 330 356 fi 331 357 if [ "$numphys" != "" ] 332 358 then 333 query 4=$query4", fNumPhysicsTrigger="$numphys359 query=$query", fNumPhysicsTrigger="$numphys 334 360 fi 335 361 if [ "$numext1" != "" ] 336 362 then 337 query 4=$query4", fNumExt1Trigger="$numext1363 query=$query", fNumExt1Trigger="$numext1 338 364 fi 339 365 if [ "$numext2" != "" ] 340 366 then 341 query 4=$query4", fNumExt2Trigger="$numext2367 query=$query", fNumExt2Trigger="$numext2 342 368 fi 343 369 if [ "$numelp" != "" ] 344 370 then 345 query 4=$query4", fNumELPTrigger="$numelp371 query=$query", fNumELPTrigger="$numelp 346 372 fi 347 373 if [ "$numilp" != "" ] 348 374 then 349 query 4=$query4", fNumILPTrigger="$numilp375 query=$query", fNumILPTrigger="$numilp 350 376 fi 351 377 if [ "$numped" != "" ] 352 378 then 353 query 4=$query4", fNumPedestalTrigger="$numped379 query=$query", fNumPedestalTrigger="$numped 354 380 fi 355 381 if [ "$numtime" != "" ] 356 382 then 357 query 4=$query4", fNumTimeTrigger="$numtime383 query=$query", fNumTimeTrigger="$numtime 358 384 fi 359 385 if [ "$numoth" != "" ] 360 386 then 361 query 4=$query4", fNumOtherTrigger="$numoth387 query=$query", fNumOtherTrigger="$numoth 362 388 fi 363 389 fi 364 390 if [ "$md5sum" != "" ] 365 391 then 366 query 4=$query4", fMd5sumRaw='"$md5sum"', fMd5sumRawZip='"$md5sumzip"'"392 query=$query", fMd5sumRaw='"$md5sum"', fMd5sumRawZip='"$md5sumzip"'" 367 393 fi 368 394 if [ "$numdrsfiles" != "" ] 369 395 then 370 query 4=$query4", fHasDrsFile="$numdrsfiles396 query=$query", fHasDrsFile="$numdrsfiles 371 397 fi 372 398 if [ "$step" != "" ] 373 399 then 374 query 4=$query4", fDrsStep="$step400 query=$query", fDrsStep="$step 375 401 fi 376 402 if [ "$compiletime" != "" ] 377 403 then 378 query 4=$query4", fCompileTime='"$compiletime"'"404 query=$query", fCompileTime='"$compiletime"'" 379 405 fi 380 406 if [ "$revnum" != "" ] 381 407 then 382 query4=$query4", fRevisionNumber='"$revnum"'" 383 fi 384 query4=$query4", fFitsFileErrors="$numfitserrors 385 query4=$query4" "$querystop 386 printprocesslog "INFO insert/update entry in DB. QUERY: "$query4 387 if ! /usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query4" 388 then 389 printprocesslog "ERROR insert/update of "$numfromfile" to mysql failed." 390 finish 391 fi 408 query=$query", fRevisionNumber='"$revnum"'" 409 fi 410 query=$query", fFitsFileErrors="$numfitserrors 411 query=$query" "$querystop 412 printprocesslog "INFO insert/update entry in DB. QUERY: "$query 413 # send query to DB 414 sendquery >/dev/null 415 #if ! /usr/bin/mysql -u operator --host=fact01.fact.local --password=$password FactData -e "$query4" 416 #then 417 # printprocesslog "ERROR insert/update of "$numfromfile" to mysql failed." 418 # finish 419 #fi 392 420 done 393 421 done
Note:
See TracChangeset
for help on using the changeset viewer.