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

Last change on this file since 19948 was 19549, checked in by Daniela Dorner, 5 years ago
add grb-run
  • Property svn:executable set to *
File size: 47.1 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 IN (1, 18) "
236 numdatruns=`sendquery`
237 # select number of results
238 query="SELECT COUNT(*) FROM AnalysisResultsRunLP WHERE fNight="$date2
239 numresults=`sendquery`
240
241 printprocesslog "disk: "
242 printprocesslog " newdaq "${newdaq[@]}
243 printprocesslog " newdata "${daq[@]}
244 printprocesslog " newdata zip "${zip[@]}
245 printprocesslog " dl00 "${dl00[@]}
246 printprocesslog " wue "${wue[@]}
247 printprocesslog " arch "${archive[@]}
248 printprocesslog " fail "${fails[@]}
249 #printprocesslog " phido "${phido[@]}
250 printprocesslog " qla "${qla[@]}
251 printprocesslog "db: "
252 printprocesslog " runinfo "$numruns
253 printprocesslog " rsynced "$numrsynced
254 printprocesslog " isdc "$numisdc
255 printprocesslog " isdc "$numisdc2" (incl fails folder)"
256 printprocesslog " wue "$numwue
257 #printprocesslog " phido "$numphido
258 printprocesslog " data "$numdatruns
259 printprocesslog " results "$numresults
260 echo "" >> $logfile 2>&1
261 echo "" >> $logfile 2>&1
262 echo "" >> $logfile 2>&1
263 echo `date`": checking the transfer..." >> $logfile 2>&1
264 echo "" >> $logfile 2>&1
265 echo "disk: " >> $logfile 2>&1
266 echo " newdaq "${newdaq[@]} >> $logfile 2>&1
267 echo " newdata "${daq[@]} >> $logfile 2>&1
268 echo " newdata zip "${zip[@]} >> $logfile 2>&1
269 echo " dl00 "${dl00[@]} >> $logfile 2>&1
270 echo " wue "${wue[@]} >> $logfile 2>&1
271 echo " arch "${archive[@]} >> $logfile 2>&1
272 echo " fail "${fails[@]} >> $logfile 2>&1
273 #echo " phido "${phido[@]} >> $logfile 2>&1
274 echo " qla "${qla[@]} >> $logfile 2>&1
275 echo "db: " >> $logfile 2>&1
276 echo " runinfo "$numruns >> $logfile 2>&1
277 echo " rsynced "$numrsynced >> $logfile 2>&1
278 echo " isdc "$numisdc >> $logfile 2>&1
279 echo " isdc "$numisdc2" (incl fails folder)" >> $logfile 2>&1
280 echo " wue "$numwue >> $logfile 2>&1
281 #echo " phido "$numphido >> $logfile 2>&1
282 echo " datruns "$numdatruns >> $logfile 2>&1
283
284 if ! [ $numdatruns -eq $qla ]
285 then
286 printprocesslog "WARN not all data runs are processed yet by the QLA for "$date" (numdatruns "$numdatruns" numqla "$qla")."
287 echo "WARN not all data runs are processed yet by the QLA for "$date" (numdatruns "$numdatruns" numqla "$qla")." >> $logfile 2>&1
288 result1="1-"
289 else
290 result1="0-"
291 fi
292 # check if file are available in the different places
293 if [ ${dl00[0]} -eq -1 ] && [ $date2 -lt 20120308 ]
294 then
295 printprocesslog "INFO data not available on /scratch on dl00 for "$date
296 echo "INFO data not available on /scratch on dl00 for "$date >> $logfile 2>&1
297 fi
298 if [ ${archive[0]} -eq -1 ]
299 then
300 printprocesslog "INFO data not in archive for "$date
301 echo "INFO data not in archive for "$date >> $logfile 2>&1
302 fi
303
304 # check if number of files agree in the different places
305 # lp
306 if ! [ ${daq[0]} -eq -1 ] && ! [ ${daq[0]} -eq ${newdaq[0]} ]
307 then
308 printprocesslog "WARN number of files on newdata (" ${daq[0]}") does not agree with number of files on newdaq (" ${newdaq[0]}") for "$date
309 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
310 numpb=`echo " $numpb + 1 " | bc -l `
311 result1=$result1"1"
312 else
313 numok=`echo " $numok + 1 " | bc -l `
314 result1=$result1"0"
315 fi
316 # dl00
317 #if ! [ ${dl00[0]} -eq -1 ] && ! [ ${dl00[0]} -eq ${newdaq[0]} ]
318 if ! [ ${dl00[0]} -eq ${newdaq[0]} ]
319 then
320 printprocesslog "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
321 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
322 numpb=`echo " $numpb + 1 " | bc -l `
323 result1=$result1"1"
324 else
325 numok=`echo " $numok + 1 " | bc -l `
326 result1=$result1"0"
327 fi
328 # archive
329 if ! [ ${archive[0]} -eq -1 ] && ! [ ${archive[0]} -eq ${newdaq[0]} ]
330 then
331 printprocesslog "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
332 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
333 #check /archive/rev_1/failed
334 if ! [ ${fails[0]} -eq -1 ]
335 then
336 sum=`echo " ${fails[0]} + ${archive[0]} " | bc -l `
337 if ! [ $sum -eq ${newdaq[0]} ]
338 then
339 printprocesslog "ERROR number of files in whole archive ("$sum") is different from number of files in La Palma ("${newdaq[0]}") for "$date"."
340 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
341 numpb=`echo " $numpb + 1 " | bc -l `
342 result1=$result1"1"
343 else
344 numok=`echo " $numok + 1 " | bc -l `
345 result1=$result1"0"
346 fi
347 else
348 result1=$result1"1"
349 fi
350 else
351 if [ ${archive[0]} -eq -1 ]
352 then
353 numpb=`echo " $numpb + 1 " | bc -l `
354 result1=$result1"1"
355 else
356 numok=`echo " $numok + 1 " | bc -l `
357 result1=$result1"0"
358 fi
359 fi
360 # wue
361 #if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${newdaq[0]} ]
362 if ! [ ${wue[0]} -eq ${newdaq[0]} ]
363 then
364 printprocesslog "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
365 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
366 numpb=`echo " $numpb + 1 " | bc -l `
367 result1=$result1"1"
368 else
369 numok=`echo " $numok + 1 " | bc -l `
370 result1=$result1"0"
371 fi
372 ## phido
373 #if ! [ ${phido[0]} -eq -1 ] && ! [ ${phido[0]} -eq ${newdaq[0]} ]
374 #then
375 # printprocesslog "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
376 # 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
377 # numpb=`echo " $numpb + 1 " | bc -l `
378 # result1=$result1"1"
379 #else
380 # numok=`echo " $numok + 1 " | bc -l `
381 # result1=$result1"0"
382 #fi
383
384 short2=
385 # num files
386 if [ "$result1" != "0-0000" ] && [ "$short" != "no" ]
387 then
388 short2="yes"
389 fi
390
391 if [ "$short2" = "yes" ]
392 then
393 printprocesslog "number of files does not yet agree in all sites ("$result1") -> do no further checking."
394 echo "" >> $logfile 2>&1
395 echo "number of files does not yet agree in all sites ("$result1") -> do no further checking." >> $logfile 2>&1
396 echo "" >> $logfile 2>&1
397 # print to console
398 echo "SUMMARY for "$date
399 echo "-----------------------"
400 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) "
401 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
402 # print to single logfile
403 echo "SUMMARY for "$date >> $logfile 2>&1
404 echo "-----------------------" >> $logfile 2>&1
405 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
406 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
407 # print to global logfile
408 echo "SUMMARY for "$date >> $logfile2 2>&1
409 echo "-----------------------" >> $logfile2 2>&1
410 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
411 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
412 continue
413 fi
414
415 # check du for raw files
416 # la palma
417 if ! [ ${newdaq[1]} -eq ${daq[1]} ]
418 then
419 printprocesslog "INFO size of data doesn't agree on newdaq ("${newdaq[1]}") and newdata ("${daq[1]}") for "$date
420 echo "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and newdata ("${daq[1]}") for "$date >> $logfile 2>&1
421 numdiff=`echo " $numdiff + 1 " | bc -l `
422 numpb=`echo " $numpb + 1 " | bc -l `
423 result2="1"
424 else
425 numok=`echo " $numok + 1 " | bc -l `
426 result2="0"
427 fi
428 # check du for zipped raw files
429 # dl00
430 if ! [ ${zip[1]} -eq ${dl00[1]} ] && [ $date2 -gt 20120307 ]
431 then
432 printprocesslog "INFO size of data doesn't agree on newdata-zip ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date
433 echo "WARN size of data doesn't agree on newdata-zip ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date >> $logfile 2>&1
434 if ! [ ${dl00[1]} -eq -1 ]
435 then
436 numdiff=`echo " $numdiff + 1 " | bc -l `
437 numpb=`echo " $numpb + 1 " | bc -l `
438 result2=$result2"1"
439 else
440 numok=`echo " $numok + 1 " | bc -l `
441 result2=$result2"0"
442 fi
443 else
444 numok=`echo " $numok + 1 " | bc -l `
445 result2=$result2"0"
446 fi
447 # archive
448 if ! [ ${zip[1]} -eq ${archive[1]} ]
449 then
450 printprocesslog "INFO size of data doesn't agree on newdata-zip ("${zip[1]}") and in archive ("${archive[1]}") for "$date
451 echo "WARN size of data doesn't agree on newdata-zip ("${zip[1]}") and in archive ("${archive[1]}") for "$date >> $logfile 2>&1
452 if ! [ ${archive[1]} -eq -1 ]
453 then
454 numdiff=`echo " $numdiff + 1 " | bc -l `
455 numpb=`echo " $numpb + 1 " | bc -l `
456 result2=$result2"1"
457 else
458 numok=`echo " $numok + 1 " | bc -l `
459 result2=$result2"0"
460 fi
461 else
462 numok=`echo " $numok + 1 " | bc -l `
463 result2=$result2"0"
464 fi
465 # wue
466 if ! [ ${zip[1]} -eq ${wue[1]} ]
467 then
468 printprocesslog "INFO size of data doesn't agree on newdata-zip ("${zip[1]}") and in Wue ("${wue[1]}") for "$date
469 echo "WARN size of data doesn't agree on newata-zip ("${zip[1]}") and in Wue ("${wue[1]}") for "$date >> $logfile 2>&1
470 if ! [ ${wue[1]} -eq -1 ]
471 then
472 numdiff=`echo " $numdiff + 1 " | bc -l `
473 numpb=`echo " $numpb + 1 " | bc -l `
474 result2=$result2"1"
475 else
476 numok=`echo " $numok + 1 " | bc -l `
477 result2=$result2"0"
478 fi
479 else
480 numok=`echo " $numok + 1 " | bc -l `
481 result2=$result2"0"
482 fi
483 ## phido
484 #if ! [ ${zip[1]} -eq ${phido[1]} ]
485 #then
486 # printprocesslog "WARN size of data doesn't agree on newdata-zip ("${zip[1]}") and on Phido ("${phido[1]}") for "$date
487 # echo "WARN size of data doesn't agree on newdata-zip ("${zip[1]}") and on Phido ("${phido[1]}") for "$date >> $logfile 2>&1
488 # if ! [ ${phido[1]} -eq -1 ]
489 # then
490 # numdiff=`echo " $numdiff + 1 " | bc -l `
491 # numpb=`echo " $numpb + 1 " | bc -l `
492 # result2=$result2"1"
493 # else
494 # numok=`echo " $numok + 1 " | bc -l `
495 # result2=$result2"0"
496 # fi
497 #else
498 # numok=`echo " $numok + 1 " | bc -l `
499 # result2=$result2"0"
500 #fi
501 #result=$result"-"
502
503 # check DB (only starting from 8.3.2012) (if-clause to be removed later)
504 if [ $date2 -gt 20120307 ]
505 then
506 # lp
507 if ! [ $numruns -eq ${newdaq[0]} ]
508 then
509 printprocesslog "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns") for "$date" [DB]"
510 echo "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns") for "$date" [DB]" >> $logfile 2>&1
511 numpb=`echo " $numpb + 1 " | bc -l `
512 result3="1"
513 else
514 numok=`echo " $numok + 1 " | bc -l `
515 result3="0"
516 fi
517 # dl00
518 if ! [ $numruns -eq $numrsynced ]
519 then
520 printprocesslog "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns") for "$date" [DB]"
521 echo "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns") for "$date" [DB]" >> $logfile 2>&1
522 numpb=`echo " $numpb + 1 " | bc -l `
523 result3=$result3"1"
524 else
525 numok=`echo " $numok + 1 " | bc -l `
526 result3=$result3"0"
527 fi
528 # archive
529 if ! [ $numruns -eq $numisdc ]
530 then
531 printprocesslog "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns") for "$date" [DB]"
532 echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns") for "$date" [DB]" >> $logfile 2>&1
533 numisdctotal=`echo " $numisdc + $numisdc2 " | bc -l `
534 if ! [ $numruns -eq $numisdc2 ]
535 then
536 printprocesslog "WARN number of ingested files in archive incl fails folder ("$numisdc2") not equal to number of runs ("$numruns") for "$date" [DB]"
537 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
538 numpb=`echo " $numpb + 1 " | bc -l `
539 result3=$result3"1"
540 else
541 numok=`echo " $numok + 1 " | bc -l `
542 result3=$result3"0"
543 fi
544 else
545 numok=`echo " $numok + 1 " | bc -l `
546 result3=$result3"0"
547 fi
548 # wue
549 if ! [ $numruns -eq $numwue ]
550 then
551 printprocesslog "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns") for "$date" [DB]"
552 echo "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns") for "$date" [DB]" >> $logfile 2>&1
553 numpb=`echo " $numpb + 1 " | bc -l `
554 result3=$result3"1"
555 else
556 numok=`echo " $numok + 1 " | bc -l `
557 result3=$result3"0"
558 fi
559 ## phido
560 #if ! [ $numruns -eq $numphido ]
561 #then
562 # printprocesslog "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")"
563 # echo "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
564 # numpb=`echo " $numpb + 1 " | bc -l `
565 # result3=$result3"1"
566 #else
567 # numok=`echo " $numok + 1 " | bc -l `
568 # result3=$result3"0"
569 #fi
570 fi
571
572 # db
573 if [ "$result3" != "0000" ] && [ "$short" != "no" ]
574 then
575 short2="yes"
576 fi
577
578 if [ "$short2" = "yes" ]
579 then
580 printprocesslog "number of files does not yet agree in db ("$result3") -> do no further checking."
581 echo "" >> $logfile 2>&1
582 echo "number of files does not yet agree in db ("$result3") -> do no further checking." >> $logfile 2>&1
583 echo "" >> $logfile 2>&1
584 # print to console
585 echo "SUMMARY for "$date" (DB):"
586 echo "-----------------------------"
587 echo " number of runs does not yet agree in DB: "${newdaq[0]}" (newdaq) "$numruns}" (RunInfo) "$numrsynced" (RsyncedToISDC) "$numisdc" (AvailISDC) "$numwue" (AvailWue) "
588 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
589 # print to single logfile
590 echo "SUMMARY for "$date" (DB):" >> $logfile 2>&1
591 echo "-----------------------------" >> $logfile 2>&1
592 echo " number of runs does not yet agree in DB: "${newdaq[0]}" (newdaq) "$numruns}" (RunInfo) "$numrsynced" (RsyncedToISDC) "$numisdc" (AvailISDC) "$numwue" (AvailWue) " >> $logfile 2>&1
593 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
594 # print to global logfile
595 echo "SUMMARY for "$date" (DB):" >> $logfile2 2>&1
596 echo "-----------------------------" >> $logfile2 2>&1
597 echo " number of runs does not yet agree in DB: "${newdaq[0]}" (newdaq) "$numruns}" (RunInfo) "$numrsynced" (RsyncedToISDC) "$numisdc" (AvailISDC) "$numwue" (AvailWue) " >> $logfile2 2>&1
598 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
599 continue
600 fi
601
602 #numdiff=0 # add for debugging so that single file sizes are not checked
603 printprocesslog "numdiff: "$numdiff
604 printprocesslog "INFO numok: "$numok
605 printprocesslog "INFO numpb: "$numpb
606 echo "numdiff: "$numdiff >> $logfile 2>&1
607 echo "INFO numok: "$numok >> $logfile 2>&1
608 echo "INFO numpb: "$numpb >> $logfile 2>&1
609 #if [ $numdiff -gt 0 ]
610 if [ $numdiff -ge 0 ]
611 then
612 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2
613 runs=( `sendquery` )
614 archivediffcounter=0
615 archiveokcounter=0
616 wuediffcounter=0
617 wueokcounter=0
618 #phidodiffcounter=0
619 #phidookcounter=0
620 dl00diffcounter=0
621 dl00okcounter=0
622 daqdiffcounter=0
623 daqokcounter=0
624 printprocesslog "INFO found "${#runs[@]}" rawfiles in DB."
625 echo "INFO found "${#runs[@]}" rawfiles in DB." >> $logfile 2>&1
626 for run in ${runs[@]}
627 do
628 rawfile=$date2"_"`printf %03d $run`".fits"
629 #rawfile2=$rawfile".gz"
630 rawfile2=$rawfile".*z"
631 printprocesslog "INFO checking "$rawfile2
632
633 # get file sizes for run
634 #sizenewdaq=( `ssh fact@161.72.93.138 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
635 sizenewdaq=( `ssh fact@161.72.93.138 "ls -lH ${lprawpath}/${rawfile2} 2>/dev/null | awk '{ print \\\$5 }'"` )
636 sizedaq=( `ssh fact@161.72.93.138 "ls -l $lprawpath2/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
637 sizezip=( `ssh fact@161.72.93.138 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
638 if ! [ ${dl00[1]} -eq -1 ]
639 then
640 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
641 fi
642 if ! [ ${archive[1]} -eq -1 ]
643 then
644 sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
645 fi
646 if ! [ ${fails[1]} -eq -1 ]
647 then
648 sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
649 fi
650 if ! [ ${wue[1]} -eq -1 ]
651 then
652 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
653 fi
654
655 if [ "$sizenewdaq" = "" ] || [ "$sizedaq" = "" ] || [ "$sizezip" = "" ] || [ "$sizedl00" = "" ] || [ "$sizewue" = "" ] || ([ "$sizefails" = "" ] && [ "$sizearchive" = "" ])
656 then
657 printprocesslog "WARN one or more of the sizes empty: "$sizenewdaq"(newdaq) "$sizedaq"(newdata) "$sizezip"(newdata zip) "$sizedl00"(dl) "$sizewue"(wue) "$sizefails"(fails) "$sizearchive"(arch) "
658 continue
659 fi
660 #if ! [ ${phido[1]} -eq -1 ]
661 #then
662 # 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 }'"` )
663 #fi
664
665 # check file sizes for run
666 # lp
667 if ! [ "$sizenewdaq" = "$sizedaq" ]
668 then
669 printprocesslog "WARN "$rawfile2" newdaq("$sizenewdaq") newdata("$sizedaq")"
670 echo " "$rawfile2" newdaq("$sizenewdaq") newdata("$sizedaq")" >> $logfile 2>&1
671 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
672 else
673 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
674 fi
675 # dl00
676 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
677 then
678 printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") dl00("$sizedl00")"
679 echo " "$rawfile2" newdata-zip("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
680 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
681 else
682 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
683 fi
684 # archive
685 #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
686 #if [ ${archive[1]} -ne -1 ] && [ "$sizezip" != "$sizearchive" -o "$sizezip" != "$sizefails" ]
687 if [ ${archive[1]} -ne -1 -a "$sizezip" != "$sizearchive" -a "$sizezip" != "$sizefails" ]
688 then
689 printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") archive("$sizearchive"/"$sizefails")"
690 echo " "$rawfile2" newdata-zip("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
691 #echo " "$sizezip"-"$sizearchive"-"${archive[1]}"-"$sizezip"-"$sizefails"-"${fails[1]}
692 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
693 else
694 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
695 fi
696 # wue
697 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
698 then
699 printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") wue("$sizewue")"
700 echo " "$rawfile2" newdata-zip("$sizezip") wue("$sizewue")" >> $logfile 2>&1
701 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
702 else
703 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
704 fi
705 ## phido
706 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
707 #then
708 # printprocesslog " "$rawfile2" newdata-zip("$sizezip") phido("$sizephido")"
709 # echo " "$rawfile2" newdata-zip("$sizezip") phido("$sizephido")" >> $logfile 2>&1
710 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
711 #else
712 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
713 #fi
714 done
715 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
716 drsruns=( `sendquery` )
717 printprocesslog "INFO found "${#drsruns[@]}" drsfiles in DB."
718 echo "INFO found "${#drsruns[@]}" drsfiles in DB." >> $logfile 2>&1
719 for drsrun in ${drsruns[@]}
720 do
721 rawfile=$date2"_"`printf %03d $drsrun`".drs.fits"
722 printprocesslog "INFO checking "$rawfile
723 #rawfile2=$rawfile".gz"
724 rawfile2=$rawfile".*z"
725 # get file sizes for run
726 #sizenewdaq=( `ssh fact@161.72.93.138 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
727 sizenewdaq=( `ssh fact@161.72.93.138 "ls -lH ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
728 sizedaq=( `ssh fact@161.72.93.138 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
729 sizezip=( `ssh fact@161.72.93.138 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
730 if ! [ ${dl00[1]} -eq -1 ]
731 then
732 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
733 fi
734 if ! [ ${archive[1]} -eq -1 ]
735 then
736 sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
737 fi
738 if ! [ ${fails[1]} -eq -1 ]
739 then
740 sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
741 fi
742 if ! [ ${wue[1]} -eq -1 ]
743 then
744 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
745 fi
746 #if ! [ ${phido[1]} -eq -1 ]
747 #then
748 # 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 }'"` )
749 #fi
750 if [ "$sizenewdaq" = "" ] || [ "$sizedaq" = "" ] || [ "$sizezip" = "" ] || [ "$sizedl00" = "" ] || [ "$sizewue" = "" ] || ([ "$sizefails" = "" ] && [ "$sizearchive" = "" ])
751 then
752 printprocesslog "WARN one or more of the sizes empty: "$sizenewdaq"(newdaq) "$sizedaq"(newdata) "$sizezip"(newdata zip) "$sizedl00"(dl) "$sizewue"(wue) "$sizefails"(fails) "$sizearchive"(arch) "
753 continue
754 fi
755
756 # check file sizes for run
757 # lp
758 if ! [ "$sizenewdaq" = "$sizedaq" ]
759 then
760 printprocesslog "WARN "$rawfile" newdaq("$sizenewdaq") newdata("$sizedaq")"
761 echo " "$rawfile" newdaq("$sizenewdaq") newdata("$sizedaq")" >> $logfile 2>&1
762 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
763 else
764 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
765 fi
766 # dl00
767 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
768 then
769 printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") dl00("$sizedl00")"
770 echo " "$rawfile2" newdata-zip("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
771 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
772 else
773 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
774 fi
775 #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
776 if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ]
777 then
778 printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") archive("$sizearchive"/"$sizefails")"
779 echo " "$rawfile2" newdata-zip("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
780 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
781 else
782 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
783 fi
784 # wue
785 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
786 then
787 printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") wue("$sizewue")"
788 echo " "$rawfile2" newdata-zip("$sizezip") wue("$sizewue")" >> $logfile 2>&1
789 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
790 else
791 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
792 fi
793 ## phido
794 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
795 #then
796 # printprocesslog "WARN "$rawfile2" newdata-zip("$sizezip") phido("$sizephido")"
797 # echo " "$rawfile2" newdata-zip("$sizezip") phido("$sizephido")" >> $logfile 2>&1
798 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
799 #else
800 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
801 #fi
802 done
803
804 #result=$result"-"
805 # raw files
806 if [ $daqokcounter -eq ${daq[0]} ]
807 then
808 numok=`echo " $numok + 1 " | bc -l `
809 result4="0"
810 else
811 result4="1"
812 numpb=`echo " $numpb + 1 " | bc -l `
813 fi
814 # zipped files
815 # dl00
816 if [ $dl00okcounter -eq ${dl00[0]} ]
817 then
818 result4=$result4"0"
819 numok=`echo " $numok + 1 " | bc -l `
820 else
821 result4=$result4"1"
822 numpb=`echo " $numpb + 1 " | bc -l `
823 fi
824 # archive
825 # daq had been used, because archive[0] doesn't include fails[0]
826 #if [ $archiveokcounter -eq ${newdaq[0]} ]
827 # archive[0] had been used, because newdaq[0] might be empty
828 # in case the data was taken on data
829 #if [ $archiveokcounter -eq ${archive[0]} ]
830 # compare with daq[0] as there should be always data on data
831 if [ $archiveokcounter -eq ${daq[0]} ]
832 then
833 result4=$result4"0"
834 numok=`echo " $numok + 1 " | bc -l `
835 else
836 result4=$result4"1"
837 numpb=`echo " $numpb + 1 " | bc -l `
838 fi
839 # wue
840 if [ $wueokcounter -eq ${wue[0]} ]
841 then
842 result4=$result4"0"
843 numok=`echo " $numok + 1 " | bc -l `
844 else
845 result4=$result4"1"
846 numpb=`echo " $numpb + 1 " | bc -l `
847 fi
848 ## phido
849 #if [ $phidookcounter -eq ${phido[0]} ]
850 #then
851 # result4=$result4"0"
852 # numok=`echo " $numok + 1 " | bc -l `
853 #else
854 # result4=$result4"1"
855 # numpb=`echo " $numpb + 1 " | bc -l `
856 #fi
857 printprocesslog "INFO "$daqokcounter" files are ok on newdata."
858 printprocesslog "INFO "$dl00okcounter" files are ok on dl00."
859 printprocesslog "INFO "$wueokcounter" files are ok in Wue."
860 printprocesslog "INFO "$archiveokcounter" files are ok in the archive."
861 #printprocesslog "INFO "$phidookcounter" files are ok on Phido."
862 echo "INFO "$daqokcounter" files are ok on newdata." >> $logfile 2>&1
863 echo "INFO "$dl00okcounter" files are ok on dl00." >> $logfile 2>&1
864 echo "INFO "$wueokcounter" files are ok in Wue." >> $logfile 2>&1
865 echo "INFO "$archiveokcounter" files are ok in the archive." >> $logfile 2>&1
866 #echo "INFO "$phidookcounter" files are ok on Phido." >> $logfile 2>&1
867 if [ $daqdiffcounter -gt 0 ]
868 then
869 printprocesslog "WARN "$daqdiffcounter" files have a different size on newdata."
870 echo "WARN "$daqdiffcounter" files have a different size on newdata." >> $logfile 2>&1
871 else
872 printprocesslog "INFO "$daqdiffcounter" files have a different size on newdata."
873 echo "INFO "$daqdiffcounter" files have a different size on newdata." >> $logfile 2>&1
874 fi
875 if [ $dl00diffcounter -gt 0 ]
876 then
877 printprocesslog "WARN "$dl00diffcounter" files have a different size on dl00."
878 echo "WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
879 else
880 printprocesslog "INFO "$dl00diffcounter" files have a different size on dl00."
881 echo "INFO "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
882 fi
883 if [ $wuediffcounter -gt 0 ]
884 then
885 printprocesslog "WARN "$wuediffcounter" files have a different size in Wue."
886 echo "WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
887 else
888 printprocesslog "INFO "$wuediffcounter" files have a different size in Wue."
889 echo "INFO "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
890 fi
891 if [ $archivediffcounter -gt 0 ]
892 then
893 printprocesslog "WARN "$archivediffcounter" files have a different size in the archive."
894 echo "WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
895 else
896 printprocesslog "INFO "$archivediffcounter" files have a different size in the archive."
897 echo "INFO "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
898 fi
899 #printprocesslog "WARN "$phidodiffcounter" files have a different size on Phido."
900 #echo "WARN "$phidodiffcounter" files have a different size on Phido." >> $logfile 2>&1
901 fi
902
903 # print summary:
904 printprocesslog "INFO day ok: "$numdaysok
905 printprocesslog "INFO numok: "$numok
906 printprocesslog "INFO numpb: "$numpb
907 printprocesslog "result:"
908 printprocesslog "(qla-#files-dudir-db-filesize)"
909 #printprocesslog " ldawp-ldawp-ldawp-ldawp"
910 printprocesslog " q-ldaw-ldaw-ldaw-ldaw"
911 printprocesslog " "$result1"-"$result2"-"$result3"-"$result4
912 echo "INFO day ok: "$numdaysok >> $logfile 2>&1
913 echo "INFO numok: "$numok >> $logfile 2>&1
914 echo "INFO numpb: "$numpb >> $logfile 2>&1
915 echo "result:" >> $logfile 2>&1
916 echo "(qla-#files-dudir-db-filesize)" >> $logfile 2>&1
917 #echo " ldawp-ldawp-ldawp-ldawp" >> $logfile 2>&1
918 echo " q-ldaw-ldaw-ldaw-ldaw" >> $logfile 2>&1
919 echo " "$result1"-"$result2"-"$result3"-"$result4 >> $logfile 2>&1
920 sumdatanew=`echo " ( ${daq[1]} + ${zip[1]} ) / 1024 / 1024 / 1024 " | bc -l | cut -d. -f1`
921 sumdata=`echo " $sumdata + $sumdatanew " | bc -l | cut -d. -f1`
922 printprocesslog "checked alread "$sumdata" GB. "$sumdatanew" "${daq[1]}" "${zip[1]}
923 if [ $numpb -lt 4 ]
924 then
925 numdaysok=`echo " $numdaysok + 1 " | bc -l `
926 fi
927
928 echo "SUMMARY for "$date
929 echo "-----------------------"
930 echo "" >> $logfile 2>&1
931 echo "SUMMARY for "$date >> $logfile 2>&1
932 echo "-----------------------" >> $logfile 2>&1
933 echo "" >> $logfile2 2>&1
934 echo "SUMMARY for "$date >> $logfile2 2>&1
935 echo "-----------------------" >> $logfile2 2>&1
936 #echo "res1:"$result1
937 #echo "res3:"$result3
938 #echo "res4:"$result4
939 #echo "arch:"${archive[0]}
940 #echo "isdc:"$numisdc
941 if [ "$result1" = "0-0000" ] && [ "$result3" = "0000" ] && [ "$result4" = "0000" ]
942 then
943 echo " EVERYTHING is ok. "$date" can be deleted. "
944 echo "" >> $logfile 2>&1
945 echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile 2>&1
946 echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile2 2>&1
947 echo " Details in the logfile "$logfile
948 echo "" >> $logfile 2>&1
949 echo " Details in the logfile "$logfile >> $logfile2 2>&1
950 sendemail="yes"
951 else
952 if [ "$result1" = "0-0000" ] && [ "$result3" = "0010" ] && [ "$result4" = "0000" ] && [ ${archive[0]} -eq $numisdc ]
953 then
954 echo " "${fails[0]}" file(s) corrupt (fails folder) - please check if files are transfered correctly! "
955 echo " "${fails[0]}" file(s) corrupt (fails folder) - please check if files are transfered correctly! " >> $logfile 2>&1
956 echo " "${fails[0]}" file(s) corrupt (fails folder) - please check if files are transfered correctly! " >> $logfile2 2>&1
957 echo " TRANSFER to be checked. "$date" can be deleted only if files in fails folder are fine. "
958 echo "" >> $logfile 2>&1
959 echo " TRANSFER to be checked. "$date" can be deleted only if files in fails folder are fine. " >> $logfile 2>&1
960 echo " TRANSFER to be checked.. "$date" can be deleted only if files in fails folder are fine. " >> $logfile2 2>&1
961 echo " Details in the logfile "$logfile
962 echo "" >> $logfile 2>&1
963 echo " Details in the logfile "$logfile >> $logfile2 2>&1
964 sendemail="yes"
965 else
966 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
967 echo "" >> $logfile 2>&1
968 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
969 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
970 echo " resetting jobs in the DB might be needed."
971 echo " resetting jobs in the DB might be needed." >> $logfile 2>&1
972 echo " resetting jobs in the DB might be needed." >> $logfile2 2>&1
973 fi
974 fi
975 if [ $daqdiffcounter -gt 0 ]
976 then
977 echo " WARN "$daqdiffcounter" files have a different size on newdata."
978 echo " WARN "$daqdiffcounter" files have a different size on newdata." >> $logfile 2>&1
979 echo " WARN "$daqdiffcounter" files have a different size on newdata." >> $logfile2 2>&1
980 fi
981 if [ $dl00diffcounter -gt 0 ]
982 then
983 echo " WARN "$dl00diffcounter" files have a different size on dl00."
984 echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
985 echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile2 2>&1
986 fi
987 if [ $wuediffcounter -gt 0 ]
988 then
989 echo " WARN "$wuediffcounter" files have a different size in Wue."
990 echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
991 echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile2 2>&1
992 fi
993 if [ $archivediffcounter -gt 0 ]
994 then
995 echo " WARN "$archivediffcounter" files have a different size in the archive."
996 echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
997 echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile2 2>&1
998 fi
999 if ! [ $numdatruns -eq $qla ]
1000 then
1001 echo " WARN not all data runs are processed yet by the QLA. "
1002 echo " WARN not all data runs are processed yet by the QLA. " >> $logfile 2>&1
1003 echo " WARN not all data runs are processed yet by the QLA. " >> $logfile2 2>&1
1004 fi
1005 if [ ${fails[0]} -gt 0 ] || [ $numisdc -ne $numisdc2 ]
1006 then
1007 numdiff=`echo " $numisdc2 - $numisdc " | bc`
1008 echo " WARN there is files marked as failed (fails folder: "${fails[0]}", DB: "$numdiff"). Please check. "
1009 echo " WARN there is files marked as failed (fails folder: "${fails[0]}", DB: "$numdiff"). Please check. " >> $logfile 2>&1
1010 echo " WARN there is files marked as failed (fails folder: "${fails[0]}", DB: "$numdiff"). Please check. " >> $logfile2 2>&1
1011 fi
1012 echo ""
1013 echo "" >> $logfile 2>&1
1014 echo "" >> $logfile2 2>&1
1015done
1016
1017#sendemail="yes"
1018if [ "$sendemail" = "yes" ]
1019then
1020 echo "" >> $logfile2 2>&1
1021 echo " REMARK: If you took some action to fix a problem and want that a day in checked again, " >> $logfile2 2>&1
1022 echo " please move the logfile to "`dirname $logfile`"CheckTransfer_YYYY-MM-DD.log.cp " >> $logfile2 2>&1
1023 echo " (or *.cp2 if the first does already exist ...) " >> $logfile2 2>&1
1024 echo " Then restart "$0 >> $logfile2 2>&1
1025 echo "" >> $logfile2 2>&1
1026
1027 echo ""
1028 echo "INFO send email with "$logfile2" to shift@fact-project.org "
1029 printprocesslog "INFO send email with "$logfile2" to shift@fact-project.org "
1030 cat $logfile2 | mail -s "Info for Deleting Data" shift@fact-project.org
1031fi
1032
1033printprocesslog "INFO finished $0"
1034
Note: See TracBrowser for help on using the repository browser.