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

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