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

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