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

Last change on this file since 18852 was 18851, checked in by Daniela Dorner, 7 years ago
adapted as discussed in telcon (implemented warning if files in fails-folder)
  • Property svn:executable set to *
File size: 46.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 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]}") for "$date"."
324 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
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 "$rawfile2
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}/${rawfile2} 2>/dev/null | awk '{ print \\\$5 }'"` )
620 sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile2 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
639 if [ "$sizenewdaq" = "" ] || [ "$sizedaq" = "" ] || [ "$sizezip" = "" ] || [ "$sizedl00" = "" ] || [ "$sizewue" = "" ] || ([ "$sizefails" = "" ] && [ "$sizearchive" = "" ])
640 then
641 printprocesslog "WARN one or more of the sizes empty: "$sizenewdaq"(newdaq) "$sizedaq"(daq) "$sizezip"(data) "$sizedl00"(dl) "$sizewue"(wue) "$sizefails"(fails) "$sizearchive"(arch) "
642 continue
643 fi
644 #if ! [ ${phido[1]} -eq -1 ]
645 #then
646 # sizephido=( `ssh -i /home_nfs/isdc/fact_opr/.ssh/id_rsa.fact_opr.phido 129.217.160.201 "ls -l $phidorawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
647 #fi
648
649 # check file sizes for run
650 # lp
651 if ! [ "$sizenewdaq" = "$sizedaq" ]
652 then
653 printprocesslog "WARN "$rawfile2" newdaq("$sizenewdaq") daq("$sizedaq")"
654 echo " "$rawfile2" newdaq("$sizenewdaq") daq("$sizedaq")" >> $logfile 2>&1
655 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
656 else
657 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
658 fi
659 # dl00
660 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
661 then
662 printprocesslog "WARN "$rawfile2" data("$sizezip") dl00("$sizedl00")"
663 echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
664 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
665 else
666 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
667 fi
668 # archive
669 #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
670 #if [ ${archive[1]} -ne -1 ] && [ "$sizezip" != "$sizearchive" -o "$sizezip" != "$sizefails" ]
671 if [ ${archive[1]} -ne -1 -a "$sizezip" != "$sizearchive" -a "$sizezip" != "$sizefails" ]
672 then
673 printprocesslog "WARN "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
674 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
675 #echo " "$sizezip"-"$sizearchive"-"${archive[1]}"-"$sizezip"-"$sizefails"-"${fails[1]}
676 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
677 else
678 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
679 fi
680 # wue
681 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
682 then
683 printprocesslog "WARN "$rawfile2" data("$sizezip") wue("$sizewue")"
684 echo " "$rawfile2" data("$sizezip") wue("$sizewue")" >> $logfile 2>&1
685 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
686 else
687 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
688 fi
689 ## phido
690 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
691 #then
692 # printprocesslog " "$rawfile2" data("$sizezip") phido("$sizephido")"
693 # echo " "$rawfile2" data("$sizezip") phido("$sizephido")" >> $logfile 2>&1
694 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
695 #else
696 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
697 #fi
698 done
699 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
700 drsruns=( `sendquery` )
701 printprocesslog "INFO found "${#drsruns[@]}" drsfiles in DB."
702 echo "INFO found "${#drsruns[@]}" drsfiles in DB." >> $logfile 2>&1
703 for drsrun in ${drsruns[@]}
704 do
705 rawfile=$date2"_"`printf %03d $drsrun`".drs.fits"
706 printprocesslog "INFO checking "$rawfile
707 #rawfile2=$rawfile".gz"
708 rawfile2=$rawfile".*z"
709 # get file sizes for run
710 #sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
711 sizenewdaq=( `ssh fact@161.72.93.131 "ls -lH ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
712 sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
713 sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
714 if ! [ ${dl00[1]} -eq -1 ]
715 then
716 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
717 fi
718 if ! [ ${archive[1]} -eq -1 ]
719 then
720 sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
721 fi
722 if ! [ ${fails[1]} -eq -1 ]
723 then
724 sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
725 fi
726 if ! [ ${wue[1]} -eq -1 ]
727 then
728 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
729 fi
730 #if ! [ ${phido[1]} -eq -1 ]
731 #then
732 # 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 }'"` )
733 #fi
734 if [ "$sizenewdaq" = "" ] || [ "$sizedaq" = "" ] || [ "$sizezip" = "" ] || [ "$sizedl00" = "" ] || [ "$sizewue" = "" ] || ([ "$sizefails" = "" ] && [ "$sizearchive" = "" ])
735 then
736 printprocesslog "WARN one or more of the sizes empty: "$sizenewdaq"(newdaq) "$sizedaq"(daq) "$sizezip"(data) "$sizedl00"(dl) "$sizewue"(wue) "$sizefails"(fails) "$sizearchive"(arch) "
737 continue
738 fi
739
740 # check file sizes for run
741 # lp
742 if ! [ "$sizenewdaq" = "$sizedaq" ]
743 then
744 printprocesslog "WARN "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
745 echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")" >> $logfile 2>&1
746 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
747 else
748 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
749 fi
750 # dl00
751 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
752 then
753 printprocesslog "WARN "$rawfile2" data("$sizezip") dl00("$sizedl00")"
754 echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
755 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
756 else
757 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
758 fi
759 #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
760 if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ]
761 then
762 printprocesslog "WARN "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
763 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
764 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
765 else
766 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
767 fi
768 # wue
769 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
770 then
771 printprocesslog "WARN "$rawfile2" data("$sizezip") wue("$sizewue")"
772 echo " "$rawfile2" data("$sizezip") wue("$sizewue")" >> $logfile 2>&1
773 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
774 else
775 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
776 fi
777 ## phido
778 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
779 #then
780 # printprocesslog "WARN "$rawfile2" data("$sizezip") phido("$sizephido")"
781 # echo " "$rawfile2" data("$sizezip") phido("$sizephido")" >> $logfile 2>&1
782 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
783 #else
784 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
785 #fi
786 done
787
788 #result=$result"-"
789 # raw files
790 if [ $daqokcounter -eq ${daq[0]} ]
791 then
792 numok=`echo " $numok + 1 " | bc -l `
793 result4="0"
794 else
795 result4="1"
796 numpb=`echo " $numpb + 1 " | bc -l `
797 fi
798 # zipped files
799 # dl00
800 if [ $dl00okcounter -eq ${dl00[0]} ]
801 then
802 result4=$result4"0"
803 numok=`echo " $numok + 1 " | bc -l `
804 else
805 result4=$result4"1"
806 numpb=`echo " $numpb + 1 " | bc -l `
807 fi
808 # archive
809 # daq had been used, because archive[0] doesn't include fails[0]
810 #if [ $archiveokcounter -eq ${newdaq[0]} ]
811 # archive[0] had been used, because newdaq[0] might be empty
812 # in case the data was taken on data
813 #if [ $archiveokcounter -eq ${archive[0]} ]
814 # compare with daq[0] as there should be always data on data
815 if [ $archiveokcounter -eq ${daq[0]} ]
816 then
817 result4=$result4"0"
818 numok=`echo " $numok + 1 " | bc -l `
819 else
820 result4=$result4"1"
821 numpb=`echo " $numpb + 1 " | bc -l `
822 fi
823 # wue
824 if [ $wueokcounter -eq ${wue[0]} ]
825 then
826 result4=$result4"0"
827 numok=`echo " $numok + 1 " | bc -l `
828 else
829 result4=$result4"1"
830 numpb=`echo " $numpb + 1 " | bc -l `
831 fi
832 ## phido
833 #if [ $phidookcounter -eq ${phido[0]} ]
834 #then
835 # result4=$result4"0"
836 # numok=`echo " $numok + 1 " | bc -l `
837 #else
838 # result4=$result4"1"
839 # numpb=`echo " $numpb + 1 " | bc -l `
840 #fi
841 printprocesslog "INFO "$daqokcounter" files are ok on daq (raw)."
842 printprocesslog "INFO "$dl00okcounter" files are ok on dl00."
843 printprocesslog "INFO "$wueokcounter" files are ok in Wue."
844 printprocesslog "INFO "$archiveokcounter" files are ok in the archive."
845 #printprocesslog "INFO "$phidookcounter" files are ok on Phido."
846 echo "INFO "$daqokcounter" files are ok on daq (raw)." >> $logfile 2>&1
847 echo "INFO "$dl00okcounter" files are ok on dl00." >> $logfile 2>&1
848 echo "INFO "$wueokcounter" files are ok in Wue." >> $logfile 2>&1
849 echo "INFO "$archiveokcounter" files are ok in the archive." >> $logfile 2>&1
850 #echo "INFO "$phidookcounter" files are ok on Phido." >> $logfile 2>&1
851 if [ $daqdiffcounter -gt 0 ]
852 then
853 printprocesslog "WARN "$daqdiffcounter" files have a different size on daq (raw)."
854 echo "WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
855 else
856 printprocesslog "INFO "$daqdiffcounter" files have a different size on daq (raw)."
857 echo "INFO "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
858 fi
859 if [ $dl00diffcounter -gt 0 ]
860 then
861 printprocesslog "WARN "$dl00diffcounter" files have a different size on dl00."
862 echo "WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
863 else
864 printprocesslog "INFO "$dl00diffcounter" files have a different size on dl00."
865 echo "INFO "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
866 fi
867 if [ $wuediffcounter -gt 0 ]
868 then
869 printprocesslog "WARN "$wuediffcounter" files have a different size in Wue."
870 echo "WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
871 else
872 printprocesslog "INFO "$wuediffcounter" files have a different size in Wue."
873 echo "INFO "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
874 fi
875 if [ $archivediffcounter -gt 0 ]
876 then
877 printprocesslog "WARN "$archivediffcounter" files have a different size in the archive."
878 echo "WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
879 else
880 printprocesslog "INFO "$archivediffcounter" files have a different size in the archive."
881 echo "INFO "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
882 fi
883 #printprocesslog "WARN "$phidodiffcounter" files have a different size on Phido."
884 #echo "WARN "$phidodiffcounter" files have a different size on Phido." >> $logfile 2>&1
885 fi
886
887 # print summary:
888 printprocesslog "INFO day ok: "$numdaysok
889 printprocesslog "INFO numok: "$numok
890 printprocesslog "INFO numpb: "$numpb
891 printprocesslog "result:"
892 printprocesslog "(qla-#files-dudir-db-filesize)"
893 #printprocesslog " ldawp-ldawp-ldawp-ldawp"
894 printprocesslog " q-ldaw-ldaw-ldaw-ldaw"
895 printprocesslog " "$result1"-"$result2"-"$result3"-"$result4
896 echo "INFO day ok: "$numdaysok >> $logfile 2>&1
897 echo "INFO numok: "$numok >> $logfile 2>&1
898 echo "INFO numpb: "$numpb >> $logfile 2>&1
899 echo "result:" >> $logfile 2>&1
900 echo "(qla-#files-dudir-db-filesize)" >> $logfile 2>&1
901 #echo " ldawp-ldawp-ldawp-ldawp" >> $logfile 2>&1
902 echo " q-ldaw-ldaw-ldaw-ldaw" >> $logfile 2>&1
903 echo " "$result1"-"$result2"-"$result3"-"$result4 >> $logfile 2>&1
904 sumdatanew=`echo " ( ${daq[1]} + ${zip[1]} ) / 1024 / 1024 / 1024 " | bc -l | cut -d. -f1`
905 sumdata=`echo " $sumdata + $sumdatanew " | bc -l | cut -d. -f1`
906 printprocesslog "checked alread "$sumdata" GB. "$sumdatanew" "${daq[1]}" "${zip[1]}
907 if [ $numpb -lt 4 ]
908 then
909 numdaysok=`echo " $numdaysok + 1 " | bc -l `
910 fi
911
912 echo "SUMMARY for "$date
913 echo "-----------------------"
914 echo "SUMMARY for "$date >> $logfile 2>&1
915 echo "-----------------------" >> $logfile 2>&1
916 echo "SUMMARY for "$date >> $logfile2 2>&1
917 echo "-----------------------" >> $logfile2 2>&1
918 #echo "res1:"$result1
919 #echo "res3:"$result3
920 #echo "res4:"$result4
921 #echo "arch:"${archive[0]}
922 #echo "isdc:"$numisdc
923 if [ "$result1" = "0-0000" ] && [ "$result3" = "0000" ] && [ "$result4" = "0000" ]
924 then
925 echo " EVERYTHING is ok. "$date" can be deleted. "
926 echo "" >> $logfile 2>&1
927 echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile 2>&1
928 echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile2 2>&1
929 echo " Details in the logfile "$logfile
930 echo "" >> $logfile 2>&1
931 echo " Details in the logfile "$logfile >> $logfile2 2>&1
932 sendemail="yes"
933 else
934 if [ "$result1" = "0-0000" ] && [ "$result3" = "0010" ] && [ "$result4" = "0000" ] && [ ${archive[0]} -eq $numisdc ]
935 then
936 echo " "${fails[0]}" file(s) corrupt (fails folder) - please check if files are transfered correctly! "
937 echo " "${fails[0]}" file(s) corrupt (fails folder) - please check if files are transfered correctly! " >> $logfile 2>&1
938 echo " "${fails[0]}" file(s) corrupt (fails folder) - please check if files are transfered correctly! " >> $logfile2 2>&1
939 echo " TRANSFER to be checked. "$date" can be deleted only if files in fails folder are fine. "
940 echo "" >> $logfile 2>&1
941 echo " TRANSFER to be checked. "$date" can be deleted only if files in fails folder are fine. " >> $logfile 2>&1
942 echo " TRANSFER to be checked.. "$date" can be deleted only if files in fails folder are fine. " >> $logfile2 2>&1
943 echo " Details in the logfile "$logfile
944 echo "" >> $logfile 2>&1
945 echo " Details in the logfile "$logfile >> $logfile2 2>&1
946 sendemail="yes"
947 else
948 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
949 echo "" >> $logfile 2>&1
950 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
951 echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
952 echo " resetting jobs in the DB might be needed."
953 echo " resetting jobs in the DB might be needed." >> $logfile 2>&1
954 echo " resetting jobs in the DB might be needed." >> $logfile2 2>&1
955 fi
956 fi
957 if [ $daqdiffcounter -gt 0 ]
958 then
959 echo " WARN "$daqdiffcounter" files have a different size on daq (raw)."
960 echo " WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
961 echo " WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile2 2>&1
962 fi
963 if [ $dl00diffcounter -gt 0 ]
964 then
965 echo " WARN "$dl00diffcounter" files have a different size on dl00."
966 echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
967 echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile2 2>&1
968 fi
969 if [ $wuediffcounter -gt 0 ]
970 then
971 echo " WARN "$wuediffcounter" files have a different size in Wue."
972 echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
973 echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile2 2>&1
974 fi
975 if [ $archivediffcounter -gt 0 ]
976 then
977 echo " WARN "$archivediffcounter" files have a different size in the archive."
978 echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
979 echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile2 2>&1
980 fi
981 if ! [ $numdatruns -eq $qla ]
982 then
983 echo " WARN not all data runs are processed yet by the QLA. "
984 echo " WARN not all data runs are processed yet by the QLA. " >> $logfile 2>&1
985 echo " WARN not all data runs are processed yet by the QLA. " >> $logfile2 2>&1
986 fi
987 if [ ${fails[0]} -gt 0 ] || [ $numisdc -ne $numisdc2 ]
988 then
989 numdiff=`echo " $numisdc2 - $numisdc " | bc`
990 echo " WARN there is files marked as failed (fails folder: "${fails[0]}", DB: "$numdiff"). Please check. "
991 echo " WARN there is files marked as failed (fails folder: "${fails[0]}", DB: "$numdiff"). Please check. " >> $logfile 2>&1
992 echo " WARN there is files marked as failed (fails folder: "${fails[0]}", DB: "$numdiff"). Please check. " >> $logfile2 2>&1
993 fi
994 echo ""
995 echo "" >> $logfile 2>&1
996 echo "" >> $logfile2 2>&1
997done
998
999#sendemail="yes"
1000if [ "$sendemail" = "yes" ]
1001then
1002 echo "" >> $logfile2 2>&1
1003 echo " REMARK: If you took some action to fix a problem and want that a day in checked again, " >> $logfile2 2>&1
1004 echo " please move the logfile to "`dirname $logfile`"CheckTransfer_YYYY-MM-DD.log.cp " >> $logfile2 2>&1
1005 echo " (or *.cp2 if the first does already exist ...) " >> $logfile2 2>&1
1006 echo " Then restart "$0 >> $logfile2 2>&1
1007 echo "" >> $logfile2 2>&1
1008
1009 echo ""
1010 echo "INFO send email with "$logfile2" to shift@fact-project.org "
1011 printprocesslog "INFO send email with "$logfile2" to shift@fact-project.org "
1012 cat $logfile2 | mail -s "Info for Deleting Data" shift@fact-project.org
1013fi
1014
1015printprocesslog "INFO finished $0"
1016
Note: See TracBrowser for help on using the repository browser.