| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 | # This script checks whether data can be deleted
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 7 | printprocesslog "INFO starting $0"
|
|---|
| 8 |
|
|---|
| 9 | logfile2=$logpath"/transfer/CheckTransfer.log"
|
|---|
| 10 | date > $logfile2 2>&1
|
|---|
| 11 |
|
|---|
| 12 | diskusage=( `ssh fact@161.72.93.131 "df -P /daq" | grep daq ` )
|
|---|
| 13 | # check if more than X GB are left on /daq
|
|---|
| 14 | if [ ${diskusage[3]} -lt 700000 ]
|
|---|
| 15 | then
|
|---|
| 16 | printprocesslog "WARN less than 700 GB left on /daq "
|
|---|
| 17 | echo "WARN less than 700 GB left on /daq "
|
|---|
| 18 | echo "WARN less than 700 GB left on /daq " >> $logfile2 2>&1
|
|---|
| 19 | sendemail="yes"
|
|---|
| 20 | fi
|
|---|
| 21 |
|
|---|
| 22 | diskusage2=( `df -P /scratch | grep scratch ` )
|
|---|
| 23 | # check if more than X GB are left on /scratch
|
|---|
| 24 | if [ ${diskusage2[3]} -lt 500000 ]
|
|---|
| 25 | then
|
|---|
| 26 | printprocesslog "WARN less than 500 GB left on /scratch "
|
|---|
| 27 | echo "WARN less than 500 GB left on /scratch "
|
|---|
| 28 | echo "WARN less than 500 GB left on /scratch " >> $logfile2 2>&1
|
|---|
| 29 | sendemail="yes"
|
|---|
| 30 | fi
|
|---|
| 31 |
|
|---|
| 32 | # needed for transfer to phido
|
|---|
| 33 | #source /home_nfs/isdc/fact_opr/myagent.sh
|
|---|
| 34 |
|
|---|
| 35 | # check first the disk in LP and on dl00
|
|---|
| 36 | ssh fact@161.72.93.131 "df -h /*da*"
|
|---|
| 37 | df -h /scratch
|
|---|
| 38 | echo ""
|
|---|
| 39 | echo "" >> $logfile2 2>&1
|
|---|
| 40 |
|
|---|
| 41 | # check next the DB to know if some transfer processes failed or crashed
|
|---|
| 42 | function check_runs_in_db()
|
|---|
| 43 | {
|
|---|
| 44 | query="SELECT "$toquery" FROM "$1" "$where
|
|---|
| 45 | #echo $query
|
|---|
| 46 | runs=( `sendquery $query` )
|
|---|
| 47 | if [ ${#runs[@]} -gt 0 ]
|
|---|
| 48 | then
|
|---|
| 49 | #for run in ${runs[@]}
|
|---|
| 50 | #do
|
|---|
| 51 | # echo $run
|
|---|
| 52 | #done
|
|---|
| 53 | sendemail="yes"
|
|---|
| 54 | echo -e "\e[1;31m\x1b[5m ==>\e[00m "$1": "${runs[@]}"\e[1;31m\x1b[5m <==\e[00m "
|
|---|
| 55 | echo "SELECT fNight, fRunId, fStartTime, fStopTime, fReturnCode FROM "$1" "$where";"
|
|---|
| 56 | echo "UPDATE "$1" SET fStartTime=NULL, fStopTime=NULL, fAvailable=NULL, fReturnCode=NULL, fProcessingSiteKey=NULL "$where";"
|
|---|
| 57 | echo -e " ==> "$1": "${runs[@]}" <== " >> $logfile2 2>&1
|
|---|
| 58 | echo "---> Please check the DB and reset the processes if needed. " >> $logfile2 2>&1
|
|---|
| 59 | echo "to check: SELECT fNight, fRunId, fStartTime, fStopTime, fReturnCode FROM "$1" "$where";" >> $logfile2 2>&1
|
|---|
| 60 | echo "to reset: UPDATE "$1" SET fStartTime=NULL, fStopTime=NULL, fAvailable=NULL, fReturnCode=NULL, fProcessingSiteKey=NULL "$where";" >> $logfile2 2>&1
|
|---|
| 61 | fi
|
|---|
| 62 | }
|
|---|
| 63 | # get information of runs where transfer had a problem
|
|---|
| 64 | toquery="fNight, fRunID, fStartTime, fStopTime, fAvailable, fProcessingSiteKey, fReturnCode "
|
|---|
| 65 | toquery="CONCAT(fNight, '_', fRunID, '(', fStartTime, '-', fStopTime, ':', fReturnCode, ')') "
|
|---|
| 66 | toquery="CONCAT(fNight, '_', fRunID, ':', fReturnCode) "
|
|---|
| 67 | toquery="IF (ISNULL(fReturnCode), CONCAT(fNight, '_', fRunID, 'crashed'), CONCAT(fNight, '_', fRunID, 'failed', fReturnCode)) "
|
|---|
| 68 | where="WHERE NOT ISNULL(fReturnCode) OR (NOT ISNULL(fStartTime) AND ISNULL(fStopTime)) AND fStartTime < DATE_ADD(Now(), INTERVAL -5 HOUR) "
|
|---|
| 69 | check_runs_in_db "RawFileRsyncedISDCStatus"
|
|---|
| 70 | check_runs_in_db "RawFileAvailWueStatus"
|
|---|
| 71 | # RawFileAvailISDC needs a different treatment
|
|---|
| 72 | # as return code 0 means that file is in fails folder in archive
|
|---|
| 73 | where="WHERE fReturnCode>0 OR (NOT ISNULL(fStartTime) AND ISNULL(fStopTime)) AND fStartTime < DATE_ADD(Now(), INTERVAL -1 HOUR) "
|
|---|
| 74 | check_runs_in_db "RawFileAvailISDCStatus"
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | # get last 10 nights (skip current night)
|
|---|
| 78 | dates=( `date +%Y/%m/%d --date="-360hour"` `date +%Y/%m/%d --date="-336hour"` `date +%Y/%m/%d --date="-312hour"` \
|
|---|
| 79 | `date +%Y/%m/%d --date="-288hour"` `date +%Y/%m/%d --date="-264hour"` `date +%Y/%m/%d --date="-240hour"` \
|
|---|
| 80 | `date +%Y/%m/%d --date="-216hour"` `date +%Y/%m/%d --date="-192hour"` `date +%Y/%m/%d --date="-168hour"` \
|
|---|
| 81 | `date +%Y/%m/%d --date="-144hour"` `date +%Y/%m/%d --date="-120hour"` `date +%Y/%m/%d --date="-96hour"` \
|
|---|
| 82 | `date +%Y/%m/%d --date="-72hour"` `date +%Y/%m/%d --date="-48hour"` `date +%Y/%m/%d --date="-24hour"` \
|
|---|
| 83 | )
|
|---|
| 84 | # get nights from directory in LP
|
|---|
| 85 | dates=( `ssh fact@161.72.93.131 "find /loc_data/zipraw -mindepth 3 -type d | sort | sed -e 's/\/loc_data\/zipraw\///g' "` )
|
|---|
| 86 |
|
|---|
| 87 | #dates=( "2013/08/02" )
|
|---|
| 88 | #short="yes"
|
|---|
| 89 |
|
|---|
| 90 | numdaysok=0
|
|---|
| 91 | numdaysoklimit=10
|
|---|
| 92 | sumdata=0
|
|---|
| 93 | checklimit=5000
|
|---|
| 94 | for date in ${dates[@]}
|
|---|
| 95 | do
|
|---|
| 96 | logfile=$logpath"/transfer/CheckTransfer_"`echo $date | sed -e 's/\//-/g'`".log"
|
|---|
| 97 | #echo ""
|
|---|
| 98 | #echo ""
|
|---|
| 99 | #echo ""
|
|---|
| 100 | #echo $date
|
|---|
| 101 | #echo "" > $logfile 2>&1
|
|---|
| 102 | #echo "" >> $logfile 2>&1
|
|---|
| 103 | #echo "" >> $logfile 2>&1
|
|---|
| 104 | echo $date > $logfile 2>&1
|
|---|
| 105 |
|
|---|
| 106 | # some counters
|
|---|
| 107 | numdiff=0
|
|---|
| 108 | numok=0
|
|---|
| 109 | numpb=0
|
|---|
| 110 |
|
|---|
| 111 | # check always only $numdaysoklimit days
|
|---|
| 112 | # and require at least $checklimit GB that have been checked
|
|---|
| 113 | # remark: bc: expr1 < expr2: the result is 1 if expr1 is strictly less than expr2
|
|---|
| 114 | if [ $numdaysok -ge $numdaysoklimit ] && [ $(echo " $sumdata > $checklimit " | bc -l) -eq 1 ]
|
|---|
| 115 | then
|
|---|
| 116 | printprocesslog "INFO more than "$numdaysoklimit" ok and more than "$checklimit" GB checked. "
|
|---|
| 117 | continue
|
|---|
| 118 | fi
|
|---|
| 119 |
|
|---|
| 120 | # get paths
|
|---|
| 121 | date2=`echo $date | sed -e 's/\///g'`
|
|---|
| 122 | # lprawpath="/daq/raw/"$date
|
|---|
| 123 | lprawpath="/newdaq/raw/"$date
|
|---|
| 124 | # lprawpath2="/loc_data/raw/"$date
|
|---|
| 125 | lprawpath2="/daq/raw/"$date
|
|---|
| 126 | lpziprawpath="/loc_data/zipraw/"$date
|
|---|
| 127 | localrawpath="/scratch/from_lapalma/raw/"$date
|
|---|
| 128 | localrawpath3="/fact/raw/"$date
|
|---|
| 129 | # localfailpath="/archive/fact/fails/raw/"$date
|
|---|
| 130 | localfailpath="/gpfs/fact/fact-archive/fails/raw/"$date
|
|---|
| 131 | wuerawpath="/fact/raw/"$date
|
|---|
| 132 | qlapath="/daq/analysis/callisto/"$date
|
|---|
| 133 | #phidorawpath="/fhgfs/groups/app/fact-construction/raw/"$date
|
|---|
| 134 |
|
|---|
| 135 | # get disk usage and number of files for directory
|
|---|
| 136 | newdaq=( `ssh fact@161.72.93.131 "if [ -d $lprawpath ]; then ls $lprawpath/* | wc -l; du -s -b --apparent-size $lprawpath; else echo '-1 -1 -1'; fi"` )
|
|---|
| 137 | daq=( `ssh fact@161.72.93.131 "if [ -d $lprawpath2 ]; then ls $lprawpath2/* | wc -l; du -s -b --apparent-size $lprawpath2; else echo '-1 -1 -1'; fi"` )
|
|---|
| 138 | if [ ${newdaq[0]} -eq -1 ] && [ ${daq[0]} -eq -1 ]
|
|---|
| 139 | then
|
|---|
| 140 | printprocesslog "INFO no data available on newdaq for "$date
|
|---|
| 141 | echo "INFO no data available on newdaq for "$date >> $logfile 2>&1
|
|---|
| 142 | continue
|
|---|
| 143 | fi
|
|---|
| 144 | zip=( `ssh fact@161.72.93.131 "if [ -d $lpziprawpath ]; then ls $lpziprawpath/* 2>/dev/null | wc -l; du -s -b --apparent-size $lpziprawpath; else echo '-1 -1 -1'; fi"` )
|
|---|
| 145 | dl00=( `if [ -d $localrawpath ]; then ls $localrawpath/* | wc -l; du -s -b --apparent-size $localrawpath; else echo '-1 -1 -1'; fi` )
|
|---|
| 146 | archive=( `if [ -d $localrawpath3 ]; then ls $localrawpath3/* 2>/dev/null | wc -l; du -L -s -b --apparent-size $localrawpath3; else echo '-1 -1 -1'; fi` )
|
|---|
| 147 | fails=( `if [ -d $localfailpath ]; then ls $localfailpath/* | wc -l; du -L -s -b --apparent-size $localfailpath; else echo '-1 -1 -1'; fi` )
|
|---|
| 148 | wue=( `ssh operator@coma.astro.uni-wuerzburg.de "if [ -d $wuerawpath ]; then ls $wuerawpath/* | wc -l; du -s -b --apparent-size $wuerawpath; else echo '-1 -1 -1'; fi"` )
|
|---|
| 149 | #phido=( `ssh -i /home_nfs/isdc/fact_opr/.ssh/id_rsa.fact_opr.phido 129.217.160.201 "if [ -d $phidorawpath ]; then ls $phidorawpath/* | wc -l; du -s -b --apparent-size $phidorawpath; else echo '-1 -1 -1'; fi"` )
|
|---|
| 150 | qla=( `ssh fact@161.72.93.131 "ls $qlapath/20*_C.root 2>/dev/null | wc -l"` )
|
|---|
| 151 | query="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM RunInfo WHERE fNight="$date2
|
|---|
| 152 | querystart="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM "
|
|---|
| 153 | queryjoin="LEFT JOIN RunInfo USING(fNight,fRunID) "
|
|---|
| 154 | querywhere="WHERE fNight="$date2" AND NOT ISNULL(fStartTime) AND NOT ISNULL(fStopTime) AND ISNULL(fReturnCode)"
|
|---|
| 155 | numruns=`sendquery`
|
|---|
| 156 | if [ "$numruns" == "" ]
|
|---|
| 157 | then
|
|---|
| 158 | numruns=0
|
|---|
| 159 | fi
|
|---|
| 160 | query=$querystart"RawFileRsyncedISDCStatus "$queryjoin" "$querywhere
|
|---|
| 161 | numrsynced=`sendquery`
|
|---|
| 162 | if [ "$numrsynced" == "" ]
|
|---|
| 163 | then
|
|---|
| 164 | numrsynced=0
|
|---|
| 165 | fi
|
|---|
| 166 | query=$querystart"RawFileAvailISDCStatus "$queryjoin" "$querywhere
|
|---|
| 167 | numisdc=`sendquery`
|
|---|
| 168 | if [ "$numisdc" == "" ]
|
|---|
| 169 | then
|
|---|
| 170 | numisdc=0
|
|---|
| 171 | fi
|
|---|
| 172 | query=$querystart"RawFileAvailWueStatus "$queryjoin" "$querywhere
|
|---|
| 173 | numwue=`sendquery`
|
|---|
| 174 | if [ "$numwue" == "" ]
|
|---|
| 175 | then
|
|---|
| 176 | numwue=0
|
|---|
| 177 | fi
|
|---|
| 178 | #query=$querystart"RawFileAvailPhidoStatus "$queryjoin" "$querywhere
|
|---|
| 179 | #numphido=`sendquery`
|
|---|
| 180 | #if [ "$numphido" == "" ]
|
|---|
| 181 | #then
|
|---|
| 182 | # numphido=0
|
|---|
| 183 | #fi
|
|---|
| 184 |
|
|---|
| 185 | # select number of data runs
|
|---|
| 186 | query="SELECT COUNT(*) FROM RunInfo WHERE fNight="$date2
|
|---|
| 187 | query=$query" AND fRunTypeKey=1"
|
|---|
| 188 | numdatruns=`sendquery`
|
|---|
| 189 |
|
|---|
| 190 | printprocesslog "disk: "
|
|---|
| 191 | printprocesslog " newdaq "${newdaq[@]}
|
|---|
| 192 | printprocesslog " daq "${daq[@]}
|
|---|
| 193 | printprocesslog " data "${zip[@]}
|
|---|
| 194 | printprocesslog " dl00 "${dl00[@]}
|
|---|
| 195 | printprocesslog " wue "${wue[@]}
|
|---|
| 196 | printprocesslog " arch "${archive[@]}
|
|---|
| 197 | printprocesslog " fail "${fails[@]}
|
|---|
| 198 | #printprocesslog " phido "${phido[@]}
|
|---|
| 199 | printprocesslog " qla "${qla[@]}
|
|---|
| 200 | printprocesslog "db: "
|
|---|
| 201 | printprocesslog " runinfo "$numruns
|
|---|
| 202 | printprocesslog " rsynced "$numrsynced
|
|---|
| 203 | printprocesslog " isdc "$numisdc
|
|---|
| 204 | printprocesslog " wue "$numwue
|
|---|
| 205 | #printprocesslog " phido "$numphido
|
|---|
| 206 | printprocesslog " data "$numdatruns
|
|---|
| 207 | echo "disk: " >> $logfile 2>&1
|
|---|
| 208 | echo " newdaq "${newdaq[@]} >> $logfile 2>&1
|
|---|
| 209 | echo " daq "${daq[@]} >> $logfile 2>&1
|
|---|
| 210 | echo " data "${zip[@]} >> $logfile 2>&1
|
|---|
| 211 | echo " dl00 "${dl00[@]} >> $logfile 2>&1
|
|---|
| 212 | echo " wue "${wue[@]} >> $logfile 2>&1
|
|---|
| 213 | echo " arch "${archive[@]} >> $logfile 2>&1
|
|---|
| 214 | echo " fail "${fails[@]} >> $logfile 2>&1
|
|---|
| 215 | #echo " phido "${phido[@]} >> $logfile 2>&1
|
|---|
| 216 | echo " qla "${qla[@]} >> $logfile 2>&1
|
|---|
| 217 | echo "db: " >> $logfile 2>&1
|
|---|
| 218 | echo " runinfo "$numruns >> $logfile 2>&1
|
|---|
| 219 | echo " rsynced "$numrsynced >> $logfile 2>&1
|
|---|
| 220 | echo " isdc "$numisdc >> $logfile 2>&1
|
|---|
| 221 | echo " wue "$numwue >> $logfile 2>&1
|
|---|
| 222 | #echo " phido "$numphido >> $logfile 2>&1
|
|---|
| 223 | echo " datruns "$numdatruns >> $logfile 2>&1
|
|---|
| 224 |
|
|---|
| 225 | if ! [ $numdatruns -eq $qla ]
|
|---|
| 226 | then
|
|---|
| 227 | printprocesslog "WARN not all data runs are processed yet by the QLA for "$date"."
|
|---|
| 228 | echo "WARN not all data runs are processed yet by the QLA for "$date >> $logfile 2>&1
|
|---|
| 229 | result1="1-"
|
|---|
| 230 | else
|
|---|
| 231 | result1="0-"
|
|---|
| 232 | fi
|
|---|
| 233 | # check if file are available in the different places
|
|---|
| 234 | if [ ${dl00[0]} -eq -1 ] && [ $date2 -lt 20120308 ]
|
|---|
| 235 | then
|
|---|
| 236 | printprocesslog "INFO data not available on /scratch on dl00 for "$date
|
|---|
| 237 | echo "INFO data not available on /scratch on dl00 for "$date >> $logfile 2>&1
|
|---|
| 238 | fi
|
|---|
| 239 | if [ ${archive[0]} -eq -1 ]
|
|---|
| 240 | then
|
|---|
| 241 | printprocesslog "INFO data not in archive for "$date
|
|---|
| 242 | echo "INFO data not in archive for "$date >> $logfile 2>&1
|
|---|
| 243 | fi
|
|---|
| 244 |
|
|---|
| 245 | # check if number of files agree in the different places
|
|---|
| 246 | # lp
|
|---|
| 247 | if ! [ ${daq[0]} -eq -1 ] && ! [ ${daq[0]} -eq ${newdaq[0]} ]
|
|---|
| 248 | then
|
|---|
| 249 | printprocesslog "WARN number of files on daq (" ${daq[0]}") does not agree with number of files on newdaq (" ${newdaq[0]}") for "$date
|
|---|
| 250 | echo "WARN number of files on daq (" ${daq[0]}") does not agree with number of files on newdaq (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
|---|
| 251 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 252 | result1=$result1"1"
|
|---|
| 253 | else
|
|---|
| 254 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 255 | result1=$result1"0"
|
|---|
| 256 | fi
|
|---|
| 257 | # dl00
|
|---|
| 258 | #if ! [ ${dl00[0]} -eq -1 ] && ! [ ${dl00[0]} -eq ${newdaq[0]} ]
|
|---|
| 259 | if ! [ ${dl00[0]} -eq ${newdaq[0]} ]
|
|---|
| 260 | then
|
|---|
| 261 | printprocesslog "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
|---|
| 262 | echo "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
|---|
| 263 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 264 | result1=$result1"1"
|
|---|
| 265 | else
|
|---|
| 266 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 267 | result1=$result1"0"
|
|---|
| 268 | fi
|
|---|
| 269 | # archive
|
|---|
| 270 | if ! [ ${archive[0]} -eq -1 ] && ! [ ${archive[0]} -eq ${newdaq[0]} ]
|
|---|
| 271 | then
|
|---|
| 272 | printprocesslog "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
|---|
| 273 | echo "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
|---|
| 274 | #check /archive/rev_1/failed
|
|---|
| 275 | if ! [ ${fails[0]} -eq -1 ]
|
|---|
| 276 | then
|
|---|
| 277 | sum=`echo " ${fails[0]} + ${archive[0]} " | bc -l `
|
|---|
| 278 | if ! [ $sum -eq ${newdaq[0]} ]
|
|---|
| 279 | then
|
|---|
| 280 | printprocesslog "ERROR number of files in whole archive ("$sum") is different from number of files in La Palma ("${newdaq[0]}")."
|
|---|
| 281 | echo "ERROR number of files in whole archive ("$sum") is different from number of files in La Palma ("${newdaq[0]}")." >> $logfile 2>&1
|
|---|
| 282 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 283 | result1=$result1"1"
|
|---|
| 284 | else
|
|---|
| 285 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 286 | result1=$result1"0"
|
|---|
| 287 | fi
|
|---|
| 288 | else
|
|---|
| 289 | result1=$result1"1"
|
|---|
| 290 | fi
|
|---|
| 291 | else
|
|---|
| 292 | if [ ${archive[0]} -eq -1 ]
|
|---|
| 293 | then
|
|---|
| 294 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 295 | result1=$result1"1"
|
|---|
| 296 | else
|
|---|
| 297 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 298 | result1=$result1"0"
|
|---|
| 299 | fi
|
|---|
| 300 | fi
|
|---|
| 301 | # wue
|
|---|
| 302 | #if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${newdaq[0]} ]
|
|---|
| 303 | if ! [ ${wue[0]} -eq ${newdaq[0]} ]
|
|---|
| 304 | then
|
|---|
| 305 | printprocesslog "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
|---|
| 306 | echo "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
|---|
| 307 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 308 | result1=$result1"1"
|
|---|
| 309 | else
|
|---|
| 310 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 311 | result1=$result1"0"
|
|---|
| 312 | fi
|
|---|
| 313 | ## phido
|
|---|
| 314 | #if ! [ ${phido[0]} -eq -1 ] && ! [ ${phido[0]} -eq ${newdaq[0]} ]
|
|---|
| 315 | #then
|
|---|
| 316 | # printprocesslog "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
|---|
| 317 | # echo "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
|---|
| 318 | # numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 319 | # result1=$result1"1"
|
|---|
| 320 | #else
|
|---|
| 321 | # numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 322 | # result1=$result1"0"
|
|---|
| 323 | #fi
|
|---|
| 324 |
|
|---|
| 325 | if [ "$short" = "yes" ] || [ "$result1" != "0-0000" ]
|
|---|
| 326 | then
|
|---|
| 327 | printprocesslog "number of files does not yet agree in all sites ("$result1") -> do no further checking."
|
|---|
| 328 | echo "number of files does not yet agree in all sites ("$result1") -> do no further checking." >> $logfile 2>&1
|
|---|
| 329 | echo ""
|
|---|
| 330 | echo "SUMMARY for "$date
|
|---|
| 331 | echo "-----------------------"
|
|---|
| 332 | echo " number of files does not yet agree in all sites: "${newdaq[0]}" (newdaq) "${daq[0]}" (daq) "${zip[0]}" (data) "${dl00[0]}" (dl) "${wue[0]}" (wue) "${archive[0]}" (arch) "${fails[0]}" (fails) "
|
|---|
| 333 | echo " "$date" is not yet transfered completely. For more details, please check the logfile "$logfile
|
|---|
| 334 | echo "" >> $logfile 2>&1
|
|---|
| 335 | echo "SUMMARY for "$date >> $logfile 2>&1
|
|---|
| 336 | echo "-----------------------" >> $logfile 2>&1
|
|---|
| 337 | echo " number of files does not yet agree in all sites: "${newdaq[0]}" (newdaq) "${daq[0]}" (daq) "${zip[0]}" (data) "${dl00[0]}" (dl) "${wue[0]}" (wue) "${archive[0]}" (arch) "${fails[0]}" (fails) " >> $logfile 2>&1
|
|---|
| 338 | echo " "$date" is not yet transfered completely. For more details, please check the logfile "$logfile >> $logfile 2>&1
|
|---|
| 339 | echo "" >> $logfile2 2>&1
|
|---|
| 340 | echo "SUMMARY for "$date >> $logfile2 2>&1
|
|---|
| 341 | echo "-----------------------" >> $logfile2 2>&1
|
|---|
| 342 | echo " number of files does not yet agree in all sites: "${newdaq[0]}" (newdaq) "${daq[0]}" (daq) "${zip[0]}" (data) "${dl00[0]}" (dl) "${wue[0]}" (wue) "${archive[0]}" (arch) "${fails[0]}" (fails) " >> $logfile2 2>&1
|
|---|
| 343 | echo " "$date" is not yet transfered completely. For more details, please check the logfile "$logfile >> $logfile2 2>&1
|
|---|
| 344 | #echo "number of files does not yet agree in all sites ("$result1") -> do no further checking. "
|
|---|
| 345 | #echo "disk: "
|
|---|
| 346 | #echo " newdaq "${newdaq[@]}
|
|---|
| 347 | #echo " daq "${daq[@]}
|
|---|
| 348 | #echo " data "${zip[@]}
|
|---|
| 349 | #echo " dl00 "${dl00[@]}
|
|---|
| 350 | #echo " wue "${wue[@]}
|
|---|
| 351 | #echo " arch "${archive[@]}
|
|---|
| 352 | #echo " fail "${fails[@]}
|
|---|
| 353 | ##echo " phido "${phido[@]}
|
|---|
| 354 | #echo "db: "
|
|---|
| 355 | #echo " runinfo "$numruns
|
|---|
| 356 | #echo " rsynced "$numrsynced
|
|---|
| 357 | #echo " isdc "$numisdc
|
|---|
| 358 | #echo " wue "$numwue
|
|---|
| 359 | ##echo " phido "$numphido
|
|---|
| 360 | continue
|
|---|
| 361 | fi
|
|---|
| 362 |
|
|---|
| 363 | #result=$result"-"
|
|---|
| 364 | # check du for raw files
|
|---|
| 365 | # la palma
|
|---|
| 366 | if ! [ ${newdaq[1]} -eq ${daq[1]} ]
|
|---|
| 367 | then
|
|---|
| 368 | printprocesslog "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and daq ("${daq[1]}") for "$date
|
|---|
| 369 | echo "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and daq ("${daq[1]}") for "$date >> $logfile 2>&1
|
|---|
| 370 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
|---|
| 371 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 372 | result2="1"
|
|---|
| 373 | else
|
|---|
| 374 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 375 | result2="0"
|
|---|
| 376 | fi
|
|---|
| 377 | # check du for zipped raw files
|
|---|
| 378 | # dl00
|
|---|
| 379 | if ! [ ${zip[1]} -eq ${dl00[1]} ] && [ $date2 -gt 20120307 ]
|
|---|
| 380 | then
|
|---|
| 381 | printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date
|
|---|
| 382 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date >> $logfile 2>&1
|
|---|
| 383 | if ! [ ${dl00[1]} -eq -1 ]
|
|---|
| 384 | then
|
|---|
| 385 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
|---|
| 386 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 387 | result2=$result2"1"
|
|---|
| 388 | else
|
|---|
| 389 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 390 | result2=$result2"0"
|
|---|
| 391 | fi
|
|---|
| 392 | else
|
|---|
| 393 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 394 | result2=$result2"0"
|
|---|
| 395 | fi
|
|---|
| 396 | # archive
|
|---|
| 397 | if ! [ ${zip[1]} -eq ${archive[1]} ]
|
|---|
| 398 | then
|
|---|
| 399 | printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date
|
|---|
| 400 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date >> $logfile 2>&1
|
|---|
| 401 | if ! [ ${archive[1]} -eq -1 ]
|
|---|
| 402 | then
|
|---|
| 403 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
|---|
| 404 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 405 | result2=$result2"1"
|
|---|
| 406 | else
|
|---|
| 407 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 408 | result2=$result2"0"
|
|---|
| 409 | fi
|
|---|
| 410 | else
|
|---|
| 411 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 412 | result2=$result2"0"
|
|---|
| 413 | fi
|
|---|
| 414 | # wue
|
|---|
| 415 | if ! [ ${zip[1]} -eq ${wue[1]} ]
|
|---|
| 416 | then
|
|---|
| 417 | printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date
|
|---|
| 418 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date >> $logfile 2>&1
|
|---|
| 419 | if ! [ ${wue[1]} -eq -1 ]
|
|---|
| 420 | then
|
|---|
| 421 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
|---|
| 422 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 423 | result2=$result2"1"
|
|---|
| 424 | else
|
|---|
| 425 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 426 | result2=$result2"0"
|
|---|
| 427 | fi
|
|---|
| 428 | else
|
|---|
| 429 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 430 | result2=$result2"0"
|
|---|
| 431 | fi
|
|---|
| 432 | ## phido
|
|---|
| 433 | #if ! [ ${zip[1]} -eq ${phido[1]} ]
|
|---|
| 434 | #then
|
|---|
| 435 | # printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and on Phido ("${phido[1]}") for "$date
|
|---|
| 436 | # echo "WARN size of data doesn't agree on data ("${zip[1]}") and on Phido ("${phido[1]}") for "$date >> $logfile 2>&1
|
|---|
| 437 | # if ! [ ${phido[1]} -eq -1 ]
|
|---|
| 438 | # then
|
|---|
| 439 | # numdiff=`echo " $numdiff + 1 " | bc -l `
|
|---|
| 440 | # numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 441 | # result2=$result2"1"
|
|---|
| 442 | # else
|
|---|
| 443 | # numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 444 | # result2=$result2"0"
|
|---|
| 445 | # fi
|
|---|
| 446 | #else
|
|---|
| 447 | # numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 448 | # result2=$result2"0"
|
|---|
| 449 | #fi
|
|---|
| 450 | #result=$result"-"
|
|---|
| 451 |
|
|---|
| 452 | # check DB (only starting from 8.3.2012) (if-clause to be removed later)
|
|---|
| 453 | if [ $date2 -gt 20120307 ]
|
|---|
| 454 | then
|
|---|
| 455 | # lp
|
|---|
| 456 | if ! [ $numruns -eq ${newdaq[0]} ]
|
|---|
| 457 | then
|
|---|
| 458 | printprocesslog "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns")"
|
|---|
| 459 | echo "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
|---|
| 460 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 461 | result3="1"
|
|---|
| 462 | else
|
|---|
| 463 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 464 | result3="0"
|
|---|
| 465 | fi
|
|---|
| 466 | # dl00
|
|---|
| 467 | if ! [ $numruns -eq $numrsynced ]
|
|---|
| 468 | then
|
|---|
| 469 | printprocesslog "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")"
|
|---|
| 470 | echo "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
|---|
| 471 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 472 | result3=$result3"1"
|
|---|
| 473 | else
|
|---|
| 474 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 475 | result3=$result3"0"
|
|---|
| 476 | fi
|
|---|
| 477 | # archive
|
|---|
| 478 | if ! [ $numruns -eq $numisdc ]
|
|---|
| 479 | then
|
|---|
| 480 | printprocesslog "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")"
|
|---|
| 481 | echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
|---|
| 482 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 483 | result3=$result3"1"
|
|---|
| 484 | else
|
|---|
| 485 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 486 | result3=$result3"0"
|
|---|
| 487 | fi
|
|---|
| 488 | # wue
|
|---|
| 489 | if ! [ $numruns -eq $numwue ]
|
|---|
| 490 | then
|
|---|
| 491 | printprocesslog "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")"
|
|---|
| 492 | echo "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
|---|
| 493 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 494 | result3=$result3"1"
|
|---|
| 495 | else
|
|---|
| 496 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 497 | result3=$result3"0"
|
|---|
| 498 | fi
|
|---|
| 499 | ## phido
|
|---|
| 500 | #if ! [ $numruns -eq $numphido ]
|
|---|
| 501 | #then
|
|---|
| 502 | # printprocesslog "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")"
|
|---|
| 503 | # echo "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
|---|
| 504 | # numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 505 | # result3=$result3"1"
|
|---|
| 506 | #else
|
|---|
| 507 | # numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 508 | # result3=$result3"0"
|
|---|
| 509 | #fi
|
|---|
| 510 | fi
|
|---|
| 511 |
|
|---|
| 512 | #numdiff=0 # add for debugging so that single file sizes are not checked
|
|---|
| 513 | printprocesslog "numdiff: "$numdiff
|
|---|
| 514 | printprocesslog "INFO numok: "$numok
|
|---|
| 515 | printprocesslog "INFO numpb: "$numpb
|
|---|
| 516 | echo "numdiff: "$numdiff >> $logfile 2>&1
|
|---|
| 517 | echo "INFO numok: "$numok >> $logfile 2>&1
|
|---|
| 518 | echo "INFO numpb: "$numpb >> $logfile 2>&1
|
|---|
| 519 | #if [ $numdiff -gt 0 ]
|
|---|
| 520 | if [ $numdiff -ge 0 ]
|
|---|
| 521 | then
|
|---|
| 522 | query="SELECT fRunID FROM RunInfo WHERE fNight="$date2
|
|---|
| 523 | runs=( `sendquery` )
|
|---|
| 524 | archivediffcounter=0
|
|---|
| 525 | archiveokcounter=0
|
|---|
| 526 | wuediffcounter=0
|
|---|
| 527 | wueokcounter=0
|
|---|
| 528 | #phidodiffcounter=0
|
|---|
| 529 | #phidookcounter=0
|
|---|
| 530 | dl00diffcounter=0
|
|---|
| 531 | dl00okcounter=0
|
|---|
| 532 | daqdiffcounter=0
|
|---|
| 533 | daqokcounter=0
|
|---|
| 534 | printprocesslog "INFO found "${#runs[@]}" rawfiles in DB."
|
|---|
| 535 | echo "INFO found "${#runs[@]}" rawfiles in DB." >> $logfile 2>&1
|
|---|
| 536 | for run in ${runs[@]}
|
|---|
| 537 | do
|
|---|
| 538 | rawfile=$date2"_"`printf %03d $run`".fits"
|
|---|
| 539 | rawfile2=$rawfile".gz"
|
|---|
| 540 |
|
|---|
| 541 | # get file sizes for run
|
|---|
| 542 | sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 543 | sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 544 | sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 545 | if ! [ ${dl00[1]} -eq -1 ]
|
|---|
| 546 | then
|
|---|
| 547 | sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
|---|
| 548 | fi
|
|---|
| 549 | if ! [ ${archive[1]} -eq -1 ]
|
|---|
| 550 | then
|
|---|
| 551 | sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
|---|
| 552 | fi
|
|---|
| 553 | if ! [ ${fails[1]} -eq -1 ]
|
|---|
| 554 | then
|
|---|
| 555 | sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
|---|
| 556 | fi
|
|---|
| 557 | if ! [ ${wue[1]} -eq -1 ]
|
|---|
| 558 | then
|
|---|
| 559 | sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 560 | fi
|
|---|
| 561 | #if ! [ ${phido[1]} -eq -1 ]
|
|---|
| 562 | #then
|
|---|
| 563 | # sizephido=( `ssh -i /home_nfs/isdc/fact_opr/.ssh/id_rsa.fact_opr.phido 129.217.160.201 "ls -l $phidorawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 564 | #fi
|
|---|
| 565 |
|
|---|
| 566 | # check file sizes for run
|
|---|
| 567 | # lp
|
|---|
| 568 | if ! [ "$sizenewdaq" = "$sizedaq" ]
|
|---|
| 569 | then
|
|---|
| 570 | printprocesslog " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
|
|---|
| 571 | echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")" >> $logfile 2>&1
|
|---|
| 572 | daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
|
|---|
| 573 | else
|
|---|
| 574 | daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
|
|---|
| 575 | fi
|
|---|
| 576 | # dl00
|
|---|
| 577 | if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
|
|---|
| 578 | then
|
|---|
| 579 | printprocesslog " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
|
|---|
| 580 | echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
|
|---|
| 581 | dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
|
|---|
| 582 | else
|
|---|
| 583 | dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
|
|---|
| 584 | fi
|
|---|
| 585 | # archive
|
|---|
| 586 | #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ] #not yet ingested files are treated wrongly
|
|---|
| 587 | #if [ ${archive[1]} -ne -1 ] && [ "$sizezip" != "$sizearchive" -o "$sizezip" != "$sizefails" ]
|
|---|
| 588 | if [ ${archive[1]} -ne -1 -a "$sizezip" != "$sizearchive" -a "$sizezip" != "$sizefails" ]
|
|---|
| 589 | then
|
|---|
| 590 | printprocesslog " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
|---|
| 591 | echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
|
|---|
| 592 | #echo " "$sizezip"-"$sizearchive"-"${archive[1]}"-"$sizezip"-"$sizefails"-"${fails[1]}
|
|---|
| 593 | archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
|
|---|
| 594 | else
|
|---|
| 595 | archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
|---|
| 596 | fi
|
|---|
| 597 | # wue
|
|---|
| 598 | if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
|
|---|
| 599 | then
|
|---|
| 600 | printprocesslog " "$rawfile2" data("$sizezip") wue("$sizewue")"
|
|---|
| 601 | echo " "$rawfile2" data("$sizezip") wue("$sizewue")" >> $logfile 2>&1
|
|---|
| 602 | wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
|
|---|
| 603 | else
|
|---|
| 604 | wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
|
|---|
| 605 | fi
|
|---|
| 606 | ## phido
|
|---|
| 607 | #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
|
|---|
| 608 | #then
|
|---|
| 609 | # printprocesslog " "$rawfile2" data("$sizezip") phido("$sizephido")"
|
|---|
| 610 | # echo " "$rawfile2" data("$sizezip") phido("$sizephido")" >> $logfile 2>&1
|
|---|
| 611 | # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
|
|---|
| 612 | #else
|
|---|
| 613 | # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
|
|---|
| 614 | #fi
|
|---|
| 615 | done
|
|---|
| 616 | query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
|
|---|
| 617 | drsruns=( `sendquery` )
|
|---|
| 618 | printprocesslog "INFO found "${#drsruns[@]}" drsfiles in DB."
|
|---|
| 619 | echo "INFO found "${#drsruns[@]}" drsfiles in DB." >> $logfile 2>&1
|
|---|
| 620 | for drsrun in ${drsruns[@]}
|
|---|
| 621 | do
|
|---|
| 622 | rawfile=$date2"_"`printf %03d $drsrun`".drs.fits"
|
|---|
| 623 | rawfile2=$rawfile".gz"
|
|---|
| 624 | # get file sizes for run
|
|---|
| 625 | sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 626 | sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 627 | sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 628 | if ! [ ${dl00[1]} -eq -1 ]
|
|---|
| 629 | then
|
|---|
| 630 | sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
|---|
| 631 | fi
|
|---|
| 632 | if ! [ ${archive[1]} -eq -1 ]
|
|---|
| 633 | then
|
|---|
| 634 | sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
|---|
| 635 | fi
|
|---|
| 636 | if ! [ ${fails[1]} -eq -1 ]
|
|---|
| 637 | then
|
|---|
| 638 | sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
|---|
| 639 | fi
|
|---|
| 640 | if ! [ ${wue[1]} -eq -1 ]
|
|---|
| 641 | then
|
|---|
| 642 | sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 643 | fi
|
|---|
| 644 | #if ! [ ${phido[1]} -eq -1 ]
|
|---|
| 645 | #then
|
|---|
| 646 | # sizephido=( `ssh -i /home_nfs/isdc/fact_opr/.ssh/id_rsa.fact_opr.phido 129.217.160.201 "ls -l $phidorawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
|---|
| 647 | #fi
|
|---|
| 648 |
|
|---|
| 649 | # check file sizes for run
|
|---|
| 650 | # lp
|
|---|
| 651 | if ! [ "$sizenewdaq" = "$sizedaq" ]
|
|---|
| 652 | then
|
|---|
| 653 | printprocesslog " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
|
|---|
| 654 | echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")" >> $logfile 2>&1
|
|---|
| 655 | daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
|
|---|
| 656 | else
|
|---|
| 657 | daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
|
|---|
| 658 | fi
|
|---|
| 659 | # dl00
|
|---|
| 660 | if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
|
|---|
| 661 | then
|
|---|
| 662 | printprocesslog " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
|
|---|
| 663 | echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
|
|---|
| 664 | dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
|
|---|
| 665 | else
|
|---|
| 666 | dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
|
|---|
| 667 | fi
|
|---|
| 668 | #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
|
|---|
| 669 | if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ]
|
|---|
| 670 | then
|
|---|
| 671 | printprocesslog " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
|---|
| 672 | echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
|
|---|
| 673 | archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
|
|---|
| 674 | else
|
|---|
| 675 | archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
|---|
| 676 | fi
|
|---|
| 677 | # wue
|
|---|
| 678 | if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
|
|---|
| 679 | then
|
|---|
| 680 | printprocesslog " "$rawfile2" data("$sizezip") wue("$sizewue")"
|
|---|
| 681 | echo " "$rawfile2" data("$sizezip") wue("$sizewue")" >> $logfile 2>&1
|
|---|
| 682 | wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
|
|---|
| 683 | else
|
|---|
| 684 | wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
|
|---|
| 685 | fi
|
|---|
| 686 | ## phido
|
|---|
| 687 | #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
|
|---|
| 688 | #then
|
|---|
| 689 | # printprocesslog " "$rawfile2" data("$sizezip") phido("$sizephido")"
|
|---|
| 690 | # echo " "$rawfile2" data("$sizezip") phido("$sizephido")" >> $logfile 2>&1
|
|---|
| 691 | # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
|
|---|
| 692 | #else
|
|---|
| 693 | # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
|
|---|
| 694 | #fi
|
|---|
| 695 | done
|
|---|
| 696 |
|
|---|
| 697 | #result=$result"-"
|
|---|
| 698 | # raw files
|
|---|
| 699 | if [ $daqokcounter -eq ${daq[0]} ]
|
|---|
| 700 | then
|
|---|
| 701 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 702 | result4="0"
|
|---|
| 703 | else
|
|---|
| 704 | result4="1"
|
|---|
| 705 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 706 | fi
|
|---|
| 707 | # zipped files
|
|---|
| 708 | # dl00
|
|---|
| 709 | if [ $dl00okcounter -eq ${dl00[0]} ]
|
|---|
| 710 | then
|
|---|
| 711 | result4=$result4"0"
|
|---|
| 712 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 713 | else
|
|---|
| 714 | result4=$result4"1"
|
|---|
| 715 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 716 | fi
|
|---|
| 717 | # archive
|
|---|
| 718 | # daq had been used, because archive[0] doesn't include fails[0]
|
|---|
| 719 | #if [ $archiveokcounter -eq ${newdaq[0]} ]
|
|---|
| 720 | # archive[0] had been used, because newdaq[0] might be empty
|
|---|
| 721 | # in case the data was taken on data
|
|---|
| 722 | #if [ $archiveokcounter -eq ${archive[0]} ]
|
|---|
| 723 | # compare with daq[0] as there should be always data on data
|
|---|
| 724 | if [ $archiveokcounter -eq ${daq[0]} ]
|
|---|
| 725 | then
|
|---|
| 726 | result4=$result4"0"
|
|---|
| 727 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 728 | else
|
|---|
| 729 | result4=$result4"1"
|
|---|
| 730 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 731 | fi
|
|---|
| 732 | # wue
|
|---|
| 733 | if [ $wueokcounter -eq ${wue[0]} ]
|
|---|
| 734 | then
|
|---|
| 735 | result4=$result4"0"
|
|---|
| 736 | numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 737 | else
|
|---|
| 738 | result4=$result4"1"
|
|---|
| 739 | numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 740 | fi
|
|---|
| 741 | ## phido
|
|---|
| 742 | #if [ $phidookcounter -eq ${phido[0]} ]
|
|---|
| 743 | #then
|
|---|
| 744 | # result4=$result4"0"
|
|---|
| 745 | # numok=`echo " $numok + 1 " | bc -l `
|
|---|
| 746 | #else
|
|---|
| 747 | # result4=$result4"1"
|
|---|
| 748 | # numpb=`echo " $numpb + 1 " | bc -l `
|
|---|
| 749 | #fi
|
|---|
| 750 | printprocesslog "INFO "$daqokcounter" files are ok on daq (raw)."
|
|---|
| 751 | printprocesslog "INFO "$dl00okcounter" files are ok on dl00."
|
|---|
| 752 | printprocesslog "INFO "$wueokcounter" files are ok in Wue."
|
|---|
| 753 | printprocesslog "INFO "$archiveokcounter" files are ok in the archive."
|
|---|
| 754 | #printprocesslog "INFO "$phidookcounter" files are ok on Phido."
|
|---|
| 755 | printprocesslog "WARN "$daqdiffcounter" files have a different size on daq (raw)."
|
|---|
| 756 | printprocesslog "WARN "$dl00diffcounter" files have a different size on dl00."
|
|---|
| 757 | printprocesslog "WARN "$wuediffcounter" files have a different size in Wue."
|
|---|
| 758 | printprocesslog "WARN "$archivediffcounter" files have a different size in the archive."
|
|---|
| 759 | #printprocesslog "WARN "$phidodiffcounter" files have a different size on Phido."
|
|---|
| 760 | echo "INFO "$daqokcounter" files are ok on daq (raw)." >> $logfile 2>&1
|
|---|
| 761 | echo "INFO "$dl00okcounter" files are ok on dl00." >> $logfile 2>&1
|
|---|
| 762 | echo "INFO "$wueokcounter" files are ok in Wue." >> $logfile 2>&1
|
|---|
| 763 | echo "INFO "$archiveokcounter" files are ok in the archive." >> $logfile 2>&1
|
|---|
| 764 | #echo "INFO "$phidookcounter" files are ok on Phido." >> $logfile 2>&1
|
|---|
| 765 | echo "WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
|
|---|
| 766 | echo "WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
|
|---|
| 767 | echo "WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
|
|---|
| 768 | echo "WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
|
|---|
| 769 | #echo "WARN "$phidodiffcounter" files have a different size on Phido." >> $logfile 2>&1
|
|---|
| 770 | fi
|
|---|
| 771 |
|
|---|
| 772 | # print summary:
|
|---|
| 773 | printprocesslog "INFO day ok: "$numdaysok
|
|---|
| 774 | printprocesslog "INFO numok: "$numok
|
|---|
| 775 | printprocesslog "INFO numpb: "$numpb
|
|---|
| 776 | printprocesslog "result:"
|
|---|
| 777 | printprocesslog "(qla-#files-dudir-db-filesize)"
|
|---|
| 778 | #printprocesslog " ldawp-ldawp-ldawp-ldawp"
|
|---|
| 779 | printprocesslog " q-ldaw-ldaw-ldaw-ldaw"
|
|---|
| 780 | printprocesslog " "$result1"-"$result2"-"$result3"-"$result4
|
|---|
| 781 | echo "INFO day ok: "$numdaysok >> $logfile 2>&1
|
|---|
| 782 | echo "INFO numok: "$numok >> $logfile 2>&1
|
|---|
| 783 | echo "INFO numpb: "$numpb >> $logfile 2>&1
|
|---|
| 784 | echo "result:" >> $logfile 2>&1
|
|---|
| 785 | echo "(qla-#files-dudir-db-filesize)" >> $logfile 2>&1
|
|---|
| 786 | #echo " ldawp-ldawp-ldawp-ldawp" >> $logfile 2>&1
|
|---|
| 787 | echo " q-ldaw-ldaw-ldaw-ldaw" >> $logfile 2>&1
|
|---|
| 788 | echo " "$result1"-"$result2"-"$result3"-"$result4 >> $logfile 2>&1
|
|---|
| 789 | sumdatanew=`echo " ( ${daq[1]} + ${zip[1]} ) / 1024 / 1024 / 1024 " | bc -l | cut -d. -f1`
|
|---|
| 790 | sumdata=`echo " $sumdata + $sumdatanew " | bc -l | cut -d. -f1`
|
|---|
| 791 | printprocesslog "checked alread "$sumdata" GB. "$sumdatanew" "${daq[1]}" "${zip[1]}
|
|---|
| 792 | if [ $numpb -lt 4 ]
|
|---|
| 793 | then
|
|---|
| 794 | numdaysok=`echo " $numdaysok + 1 " | bc -l `
|
|---|
| 795 | fi
|
|---|
| 796 |
|
|---|
| 797 | echo ""
|
|---|
| 798 | echo "SUMMARY for "$date
|
|---|
| 799 | echo "-----------------------"
|
|---|
| 800 | echo "" >> $logfile 2>&1
|
|---|
| 801 | echo "SUMMARY for "$date >> $logfile 2>&1
|
|---|
| 802 | echo "-----------------------" >> $logfile 2>&1
|
|---|
| 803 | echo "" >> $logfile2 2>&1
|
|---|
| 804 | echo "SUMMARY for "$date >> $logfile2 2>&1
|
|---|
| 805 | echo "-----------------------" >> $logfile2 2>&1
|
|---|
| 806 | #echo "res1:"$result1
|
|---|
| 807 | #echo "res3:"$result3
|
|---|
| 808 | #echo "res4:"$result4
|
|---|
| 809 | #echo "arch:"${archive[0]}
|
|---|
| 810 | #echo "isdc:"$numisdc
|
|---|
| 811 | if [ "$result1" = "0-0000" ] && [ "$result3" = "0000" ] && [ "$result4" = "0000" ]
|
|---|
| 812 | then
|
|---|
| 813 | echo " EVERYTHING is ok. "$date" can be deleted. "
|
|---|
| 814 | echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile 2>&1
|
|---|
| 815 | echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile2 2>&1
|
|---|
| 816 | echo " Details in the logfile "$logfile
|
|---|
| 817 | echo " Details in the logfile "$logfile >> $logfile 2>&1
|
|---|
| 818 | echo " Details in the logfile "$logfile >> $logfile2 2>&1
|
|---|
| 819 | sendemail="yes"
|
|---|
| 820 | else
|
|---|
| 821 | if [ "$result1" = "0-0000" ] && [ "$result3" = "0010" ] && [ "$result4" = "0000" ] && [ ${archive[0]} -eq $numisdc ]
|
|---|
| 822 | then
|
|---|
| 823 | echo " "${fails[0]}" file(s) corrupt (fails folder), but files are transfered correctly. "
|
|---|
| 824 | echo " "${fails[0]}" file(s) corrupt (fails folder), but files are transfered correctly. " >> $logfile 2>&1
|
|---|
| 825 | echo " "${fails[0]}" file(s) corrupt (fails folder), but files are transfered correctly. " >> $logfile2 2>&1
|
|---|
| 826 | echo " TRANSFER is ok. "$date" can be deleted. "
|
|---|
| 827 | echo " TRANSFER is ok. "$date" can be deleted. " >> $logfile 2>&1
|
|---|
| 828 | echo " TRANSFER is ok. "$date" can be deleted. " >> $logfile2 2>&1
|
|---|
| 829 | echo " Details in the logfile "$logfile
|
|---|
| 830 | echo " Details in the logfile "$logfile >> $logfile 2>&1
|
|---|
| 831 | echo " Details in the logfile "$logfile >> $logfile2 2>&1
|
|---|
| 832 | sendemail="yes"
|
|---|
| 833 | else
|
|---|
| 834 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
|
|---|
| 835 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
|
|---|
| 836 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
|
|---|
| 837 | echo " resetting jobs in the DB might be needed."
|
|---|
| 838 | echo " resetting jobs in the DB might be needed." >> $logfile 2>&1
|
|---|
| 839 | echo " resetting jobs in the DB might be needed." >> $logfile2 2>&1
|
|---|
| 840 | fi
|
|---|
| 841 | fi
|
|---|
| 842 | if [ $daqdiffcounter -gt 0 ]
|
|---|
| 843 | then
|
|---|
| 844 | echo " WARN "$daqdiffcounter" files have a different size on daq (raw)."
|
|---|
| 845 | echo " WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
|
|---|
| 846 | echo " WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile2 2>&1
|
|---|
| 847 | fi
|
|---|
| 848 | if [ $dl00diffcounter -gt 0 ]
|
|---|
| 849 | then
|
|---|
| 850 | echo " WARN "$dl00diffcounter" files have a different size on dl00."
|
|---|
| 851 | echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
|
|---|
| 852 | echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile2 2>&1
|
|---|
| 853 | fi
|
|---|
| 854 | if [ $wuediffcounter -gt 0 ]
|
|---|
| 855 | then
|
|---|
| 856 | echo " WARN "$wuediffcounter" files have a different size in Wue."
|
|---|
| 857 | echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
|
|---|
| 858 | echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile2 2>&1
|
|---|
| 859 | fi
|
|---|
| 860 | if [ $archivediffcounter -gt 0 ]
|
|---|
| 861 | then
|
|---|
| 862 | echo " WARN "$archivediffcounter" files have a different size in the archive."
|
|---|
| 863 | echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
|
|---|
| 864 | echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile2 2>&1
|
|---|
| 865 | fi
|
|---|
| 866 | if ! [ $numdatruns -eq $qla ]
|
|---|
| 867 | then
|
|---|
| 868 | echo "WARN not all data runs are processed yet by the QLA. "
|
|---|
| 869 | echo "WARN not all data runs are processed yet by the QLA. " >> $logfile 2>&1
|
|---|
| 870 | echo "WARN not all data runs are processed yet by the QLA. " >> $logfile2 2>&1
|
|---|
| 871 | fi
|
|---|
| 872 | done
|
|---|
| 873 |
|
|---|
| 874 | #sendemail="yes"
|
|---|
| 875 | if [ "$sendemail" = "yes" ]
|
|---|
| 876 | then
|
|---|
| 877 | echo "INFO send email with "$logfile2"to shift@fact-project.org "
|
|---|
| 878 | printprocesslog "INFO send email with "$logfile2"to shift@fact-project.org "
|
|---|
| 879 | cat $logfile2 | mail -s "testmail for info on deleting data" shift@fact-project.org
|
|---|
| 880 | fi
|
|---|
| 881 |
|
|---|
| 882 | printprocesslog "INFO finished $0"
|
|---|
| 883 |
|
|---|