- Timestamp:
- 03/22/12 16:55:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Transfer/CheckTransfer.sh
r13154 r13171 1 1 #!/bin/bash 2 2 # 3 # This script checks whether data can be transferred3 # This script checks whether data can be deleted 4 4 # 5 5 … … 14 14 `date +%Y/%m/%d --date="-72hour"` `date +%Y/%m/%d --date="-48hour"` `date +%Y/%m/%d --date="-24hour"` \ 15 15 ) 16 17 dates=( "2012/03/12" ) 16 18 17 19 numdaysok=0 … … 42 44 lpziprawpath="/loc_data/zipraw/"$date 43 45 localrawpath="/scratch/from_lapalma/raw/"$date 44 localrawpath2="/data00/fact-construction/raw/"$date46 #localrawpath2="/data00/fact-construction/raw/"$date 45 47 localrawpath3="/fact/raw/"$date 46 48 localfailpath="/archive/fact/fails/raw/"$date … … 57 59 zip=( `ssh fact@161.72.93.131 "if [ -d $lpziprawpath ]; then ls $lpziprawpath/* | wc -l; du -s -b --apparent-size $lpziprawpath; else echo '-1 -1 -1'; fi"` ) 58 60 dl00=( `if [ -d $localrawpath ]; then ls $localrawpath/* | wc -l; du -s -b --apparent-size $localrawpath; else echo '-1 -1 -1'; fi` ) 59 data00=( `if [ -d $localrawpath2 ]; then ls $localrawpath2/* | wc -l; du -s -b --apparent-size $localrawpath2; else echo '-1 -1 -1'; fi` )61 #data00=( `if [ -d $localrawpath2 ]; then ls $localrawpath2/* | wc -l; du -s -b --apparent-size $localrawpath2; else echo '-1 -1 -1'; fi` ) 60 62 archive=( `if [ -d $localrawpath3 ]; then ls $localrawpath3/* | wc -l; du -s -b --apparent-size $localrawpath3; else echo '-1 -1 -1'; fi` ) 61 63 fails=( `if [ -d $localfailpath ]; then ls $localfailpath/* | wc -l; du -s -b --apparent-size $localfailpath; else echo '-1 -1 -1'; fi` ) … … 91 93 echo " data "${data[@]} 92 94 echo " zip "${zip[@]} 93 if [ $date2 -gt 20120307 ]94 then95 #if [ $date2 -gt 20120307 ] 96 #then 95 97 echo " dl00 "${dl00[@]} 96 else97 echo " data00 "${data00[@]}98 fi98 #else 99 # echo " data00 "${data00[@]} 100 #fi 99 101 echo " arch "${archive[@]} 100 102 echo " fail "${fails[@]} … … 105 107 echo " wue "$numwue 106 108 107 # check if file are available in the differen places109 # check if file are available in the different places 108 110 if [ ${dl00[0]} -eq -1 ] && [ $date2 -lt 20120308 ] 109 111 then 110 112 echo "INFO data not available on /scratch on dl00 for "$date 111 113 fi 112 if [ ${data00[0]} -eq -1 ] && [ $date2 -gt 20120307 ]113 then114 echo "INFO data not available on /data00 for "$date115 fi114 #if [ ${data00[0]} -eq -1 ] && [ $date2 -gt 20120307 ] 115 #then 116 # echo "INFO data not available on /data00 for "$date 117 #fi 116 118 if [ ${archive[0]} -eq -1 ] 117 119 then … … 130 132 if ! [ $sum -eq ${daq[0]} ] 131 133 then 132 echo "ERROR number of files in archive ("$sum") wrong."134 echo "ERROR number of files in archive ("$sum") is different from number of files in La Palma ("${daq[0]}")." 133 135 numpb=`echo " $numpb + 1 " | bc -l ` 134 136 result="1" … … 137 139 result="0" 138 140 fi 141 else 142 result="1" 139 143 fi 140 144 else … … 162 166 result=$result"0" 163 167 fi 164 # /data00 (to be removed later)165 if ! [ ${data00[0]} -eq -1 ] && ! [ ${data00[0]} -eq ${daq[0]} ]166 then167 echo "WARN number of files in /data00 (" ${data00[0]}") does not agree with number of files in LP (" ${daq[0]}") for "$date168 fi168 ## /data00 (to be removed later) 169 #if ! [ ${data00[0]} -eq -1 ] && ! [ ${data00[0]} -eq ${daq[0]} ] 170 #then 171 # echo "WARN number of files in /data00 (" ${data00[0]}") does not agree with number of files in LP (" ${daq[0]}") for "$date 172 #fi 169 173 # wue 170 174 if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${daq[0]} ] … … 209 213 result=$result"0" 210 214 fi 211 # data00 (to be removed later)212 if ! [ ${zip[1]} -eq ${data00[1]} ] && [ $date2 -lt 20120308 ]213 then214 echo "WARN size of data doesn't agree on data ("${zip[1]}") and /data00 ("${data00[1]}") for "$date215 if ! [ ${data00[1]} -eq -1 ]216 then217 numdiff=`echo " $numdiff + 1 " | bc -l `218 fi219 fi215 ## data00 (to be removed later) 216 #if ! [ ${zip[1]} -eq ${data00[1]} ] && [ $date2 -lt 20120308 ] 217 #then 218 # echo "WARN size of data doesn't agree on data ("${zip[1]}") and /data00 ("${data00[1]}") for "$date 219 # if ! [ ${data00[1]} -eq -1 ] 220 # then 221 # numdiff=`echo " $numdiff + 1 " | bc -l ` 222 # fi 223 #fi 220 224 # archive 221 225 if ! [ ${zip[1]} -eq ${archive[1]} ] … … 280 284 if ! [ $numruns -eq $numisdc ] 281 285 then 282 echo "WARN number of rsynced in archive ("$numrsynced") not equal to number of runs ("$numruns")"286 echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")" 283 287 numpb=`echo " $numpb + 1 " | bc -l ` 284 288 result=$result"1" … … 305 309 then 306 310 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2 307 runs= `sendquery`311 runs=( `sendquery` ) 308 312 archivediffcounter=0 309 313 archiveokcounter=0 … … 314 318 datadiffcounter=0 315 319 dataokcounter=0 320 echo "INFO found "${#runs[@]}" rawfiles in DB." 316 321 for run in ${runs[@]} 317 322 do … … 327 332 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 328 333 fi 329 if ! [ ${data00[1]} -eq -1 ]330 then331 sizedata00=( `ls -l $localrawpath2/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )332 fi334 #if ! [ ${data00[1]} -eq -1 ] 335 #then 336 # sizedata00=( `ls -l $localrawpath2/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 337 #fi 333 338 if ! [ ${archive[1]} -eq -1 ] 334 339 then 335 340 sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 341 fi 342 if ! [ ${fails[1]} -eq -1 ] 343 then 344 sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 336 345 fi 337 346 if ! [ ${wue[1]} -eq -1 ] … … 357 366 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l ` 358 367 fi 359 # data00360 if ! [ "$sizezip" = "$sizedata00" ] && ! [ ${data00[1]} -eq -1 ]361 then362 echo " "$rawfile2" data("$sizezip") data00("$sizedata00")"363 fi368 ## data00 369 #if ! [ "$sizezip" = "$sizedata00" ] && ! [ ${data00[1]} -eq -1 ] 370 #then 371 # echo " "$rawfile2" data("$sizezip") data00("$sizedata00")" 372 #fi 364 373 # archive 365 if ! [ "$sizezip" = "$sizearchive" ] && ! [ ${archive[1]} -eq -1 ] 366 then 367 echo " "$rawfile2" data("$sizezip") archive("$sizearchive")" 368 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l ` 374 if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ] 375 #if ! [ "$sizezip" = "$sizearchive" ] && ! [ ${archive[1]} -eq -1 ] 376 then 377 #echo " --"$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" 378 #if ! [ "$sizezip" = "$sizefails" ] && ! [ ${fails[1]} -eq -1 ] 379 #then 380 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" 381 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l ` 382 #else 383 # archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l ` 384 #fi 369 385 else 370 386 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l ` 371 387 fi 388 #if ! [ "$sizezip" = "" ] && ! [ "$sizearchive" = "" ] && ! [ ${archive[1]} -eq -1 ] 389 #then 390 # if [ $sizezip -gt $sizearchive ] 391 # then 392 # echo "ERROR "$rawfile" smaller in archive ("$sizearchive") than on data ("$sizezip")" 393 # fi 394 #fi 372 395 # wue 373 396 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ] … … 380 403 done 381 404 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1" 382 drsruns=`sendquery` 405 drsruns=( `sendquery` ) 406 echo "INFO found "${#drsruns[@]}" drsfiles in DB." 383 407 for drsrun in ${drsruns[@]} 384 408 do … … 393 417 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 394 418 fi 395 if ! [ ${data00[1]} -eq -1 ]396 then397 sizedata00=( `ls -l $localrawpath2/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )398 fi419 #if ! [ ${data00[1]} -eq -1 ] 420 #then 421 # sizedata00=( `ls -l $localrawpath2/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 422 #fi 399 423 if ! [ ${archive[1]} -eq -1 ] 400 424 then 401 425 sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 426 fi 427 if ! [ ${fails[1]} -eq -1 ] 428 then 429 sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` ) 402 430 fi 403 431 if ! [ ${wue[1]} -eq -1 ] … … 423 451 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l ` 424 452 fi 425 # data00426 if ! [ "$sizezip" = "$sizedata00" ] && ! [ ${data00[1]} -eq -1 ]427 then428 echo " "$rawfile2" data("$sizezip") data00("$sizedata00")"429 fi453 ## data00 454 #if ! [ "$sizezip" = "$sizedata00" ] && ! [ ${data00[1]} -eq -1 ] 455 #then 456 # echo " "$rawfile2" data("$sizezip") data00("$sizedata00")" 457 #fi 430 458 # archive 431 if ! [ "$sizezip" = "$sizearchive" ] && ! [ ${archive[1]} -eq -1 ] 432 then 433 echo " "$rawfile2" data("$sizezip") archive("$sizearchive")" 434 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l ` 459 #if [ ! [ "$sizezip" = "$sizearchive" ] && ! [ ${archive[1]} -eq -1 ] ] || [ ! [ "$sizezip" = "$sizefails" ] && ! [ ${fails[1]} -eq -1 ] ] 460 if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ] 461 then 462 #echo " --"$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" 463 #if 464 #then 465 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" 466 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l ` 467 #else 468 # archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l ` 469 #fi 435 470 else 436 471 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l ` … … 447 482 448 483 result=$result"-" 449 echo "Wue: ok: "$wueokcounter" diff: "$wuediffcounter450 echo "Arch: ok: "$archiveokcounter" diff: "$archivediffcounter484 #echo "Wue: ok: "$wueokcounter" diff: "$wuediffcounter 485 #echo "Arch: ok: "$archiveokcounter" diff: "$archivediffcounter 451 486 # raw files 487 echo "INFO "$dataokcounter" files are ok on data (raw)." 488 echo "WARN "$datadiffcounter" files have a different size on data (raw)." 452 489 if [ $dataokcounter -eq ${data[0]} ] 453 490 then 454 491 numok=`echo " $numok + 1 " | bc -l ` 455 492 result=$result"0" 456 echo "INFO "$dataokcounter" files are ok on data (raw)." 457 else 458 result=$result"1" 459 numpb=`echo " $numpb + 1 " | bc -l ` 460 echo "WARN "$datadiffcounter" files have a different size on data (raw)." 493 else 494 result=$result"1" 495 numpb=`echo " $numpb + 1 " | bc -l ` 461 496 fi 462 497 # zipped files 463 498 # dl00 499 echo "INFO "$dl00okcounter" files are ok on dl00." 500 echo "WARN "$dl00diffcounter" files have a different size on dl00." 464 501 if [ $dl00okcounter -eq ${dl00[0]} ] 465 502 then 466 503 result=$result"0" 467 504 numok=`echo " $numok + 1 " | bc -l ` 468 echo "INFO "$dl00okcounter" files are ok on dl00." 469 else 470 result=$result"1" 471 numpb=`echo " $numpb + 1 " | bc -l ` 472 echo "WARN "$dl00diffcounter" files have a different size on dl00." 505 else 506 result=$result"1" 507 numpb=`echo " $numpb + 1 " | bc -l ` 473 508 fi 474 509 # archive 510 echo "INFO "$archiveokcounter" files are ok in the archive." 511 echo "WARN "$archivediffcounter" files have a different size in the archive." 475 512 if [ $archiveokcounter -eq ${daq[0]} ] 476 513 then 477 514 result=$result"0" 478 515 numok=`echo " $numok + 1 " | bc -l ` 479 echo "INFO "$archiveokcounter" files are ok in the archive." 480 else 481 result=$result"1" 482 numpb=`echo " $numpb + 1 " | bc -l ` 483 echo "WARN "$archivediffcounter" files have a different size in the archive." 516 else 517 result=$result"1" 518 numpb=`echo " $numpb + 1 " | bc -l ` 484 519 fi 485 520 # wue 521 echo "INFO "$wueokcounter" files are ok in Wue." 522 echo "WARN "$wuediffcounter" files have a different size in Wue." 486 523 if [ $wueokcounter -eq ${wue[0]} ] 487 524 then 488 525 result=$result"0" 489 526 numok=`echo " $numok + 1 " | bc -l ` 490 echo "INFO "$wueokcounter" files are ok in Wue."491 else492 result=$result"1"493 numpb=`echo " $numpb + 1 " | bc -l `494 echo "WARN "$wuediffcounter" files have a different size in Wue."495 fi496 fi527 else 528 result=$result"1" 529 numpb=`echo " $numpb + 1 " | bc -l ` 530 fi 531 fi 532 533 # list #drs 497 534 498 535 # print summary: … … 500 537 echo "INFO numok: "$numok 501 538 echo "INFO numpb: "$numpb 502 echo "result: (#files-dudir-db-filesize)" 503 echo "ldaw-ldaw-ldaw-ldaw" 504 echo $result 539 echo "result:" 540 echo "(#files-dudir-db-filesize)" 541 echo " ldaw-ldaw-ldaw-ldaw" 542 echo " "$result 505 543 #if [ $numpb -eq 0 ] 506 544 if [ $numpb -lt 4 ]
Note:
See TracChangeset
for help on using the changeset viewer.