source: trunk/DataCheck/Transfer/CheckTransfer.sh@ 18871

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