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

Last change on this file since 16126 was 15599, checked in by Daniela Dorner, 12 years ago
check files only in detail when number of files does agree
  • Property svn:executable set to *
File size: 23.9 KB
Line 
1#!/bin/bash
2#
3# This script checks whether data can be deleted
4#
5
6source `dirname $0`/../Sourcefile.sh
7printprocesslog "INFO starting $0"
8
9source /home_nfs/isdc/fact_opr/myagent.sh
10
11# check first the disk in LP and on dl00
12ssh fact@161.72.93.131 "df -h /*da*"
13df -h /scratch
14echo ""
15
16# check next the DB to know if some transfer processes failed or crashed
17function check_runs_in_db()
18{
19 query="SELECT "$toquery" FROM "$1" "$where
20 #echo $query
21 runs=( `sendquery $query` )
22 if [ ${#runs[@]} -gt 0 ]
23 then
24 #for run in ${runs[@]}
25 #do
26 # echo $run
27 #done
28 echo -e "\e[1;31m\x1b[5m ==>\e[00m "$1": "${runs[@]}"\e[1;31m\x1b[5m <==\e[00m "
29 echo "SELECT fNight, fRunId FROM "$1" "$where";"
30 echo "UPDATE "$1" SET fStartTime=NULL, fStopTime=NULL, fAvailable=NULL, fReturnCode=NULL, fProcessingSiteKey=NULL "$where";"
31 fi
32}
33# get information of runs where transfer had a problem
34toquery="fNight, fRunID, fStartTime, fStopTime, fAvailable, fProcessingSiteKey, fReturnCode "
35toquery="CONCAT(fNight, '_', fRunID, '(', fStartTime, '-', fStopTime, ':', fReturnCode, ')') "
36toquery="CONCAT(fNight, '_', fRunID, ':', fReturnCode) "
37toquery="IF (ISNULL(fReturnCode), CONCAT(fNight, '_', fRunID, 'crashed'), CONCAT(fNight, '_', fRunID, 'failed', fReturnCode)) "
38where="WHERE NOT ISNULL(fReturnCode) OR (NOT ISNULL(fStartTime) AND ISNULL(fStopTime)) AND fStartTime < DATE_ADD(Now(), INTERVAL -5 HOUR) "
39check_runs_in_db "RawFileRsyncedISDCStatus"
40check_runs_in_db "RawFileAvailWueStatus"
41# RawFileAvailISDC needs a different treatment
42# as return code 0 means that file is in fails folder in archive
43where="WHERE fReturnCode>0 OR (NOT ISNULL(fStartTime) AND ISNULL(fStopTime)) "
44check_runs_in_db "RawFileAvailISDCStatus"
45
46
47# get last 10 nights (skip current night)
48dates=( `date +%Y/%m/%d --date="-360hour"` `date +%Y/%m/%d --date="-336hour"` `date +%Y/%m/%d --date="-312hour"` \
49 `date +%Y/%m/%d --date="-288hour"` `date +%Y/%m/%d --date="-264hour"` `date +%Y/%m/%d --date="-240hour"` \
50 `date +%Y/%m/%d --date="-216hour"` `date +%Y/%m/%d --date="-192hour"` `date +%Y/%m/%d --date="-168hour"` \
51 `date +%Y/%m/%d --date="-144hour"` `date +%Y/%m/%d --date="-120hour"` `date +%Y/%m/%d --date="-96hour"` \
52 `date +%Y/%m/%d --date="-72hour"` `date +%Y/%m/%d --date="-48hour"` `date +%Y/%m/%d --date="-24hour"` \
53 )
54# get nights from directory in LP
55dates=( `ssh fact@161.72.93.131 "find /loc_data/zipraw -mindepth 3 -type d | sort | sed -e 's/\/loc_data\/zipraw\///g' "` )
56
57#dates=( "2013/04/18" )
58#short="yes"
59
60numdaysok=0
61numdaysoklimit=5
62sumdata=0
63checklimit=5000
64for date in ${dates[@]}
65do
66 echo ""
67 echo ""
68 echo ""
69 echo $date
70
71 # some counters
72 numdiff=0
73 numok=0
74 numpb=0
75
76 # check always only $numdaysoklimit days
77 # and require at least $checklimit GB that have been checked
78 # remark: bc: expr1 < expr2: the result is 1 if expr1 is strictly less than expr2
79 if [ $numdaysok -ge $numdaysoklimit ] && [ $(echo " $sumdata > $checklimit " | bc -l) -eq 1 ]
80 then
81 echo "INFO more than "$numdaysoklimit" ok and more than "$checklimit" GB checked. "
82 continue
83 fi
84
85 # get paths
86 date2=`echo $date | sed -e 's/\///g'`
87# lprawpath="/daq/raw/"$date
88 lprawpath="/newdaq/raw/"$date
89# lprawpath2="/loc_data/raw/"$date
90 lprawpath2="/daq/raw/"$date
91 lpziprawpath="/loc_data/zipraw/"$date
92 localrawpath="/scratch/from_lapalma/raw/"$date
93 localrawpath3="/fact/raw/"$date
94# localfailpath="/archive/fact/fails/raw/"$date
95 localfailpath="/gpfs/fact/fact-archive/fails/raw/"$date
96 wuerawpath="/fact/raw/"$date
97 #phidorawpath="/fhgfs/groups/app/fact-construction/raw/"$date
98
99 # get disk usage and number of files for directory
100 newdaq=( `ssh fact@161.72.93.131 "if [ -d $lprawpath ]; then ls $lprawpath/* | wc -l; du -s -b --apparent-size $lprawpath; else echo '-1 -1 -1'; fi"` )
101 daq=( `ssh fact@161.72.93.131 "if [ -d $lprawpath2 ]; then ls $lprawpath2/* | wc -l; du -s -b --apparent-size $lprawpath2; else echo '-1 -1 -1'; fi"` )
102 if [ ${newdaq[0]} -eq -1 ] && [ ${daq[0]} -eq -1 ]
103 then
104 echo "INFO no data available on newdaq for "$date
105 continue
106 fi
107 zip=( `ssh fact@161.72.93.131 "if [ -d $lpziprawpath ]; then ls $lpziprawpath/* | wc -l; du -s -b --apparent-size $lpziprawpath; else echo '-1 -1 -1'; fi"` )
108 dl00=( `if [ -d $localrawpath ]; then ls $localrawpath/* | wc -l; du -s -b --apparent-size $localrawpath; else echo '-1 -1 -1'; fi` )
109 archive=( `if [ -d $localrawpath3 ]; then ls $localrawpath3/* | wc -l; du -L -s -b --apparent-size $localrawpath3; else echo '-1 -1 -1'; fi` )
110 fails=( `if [ -d $localfailpath ]; then ls $localfailpath/* | wc -l; du -L -s -b --apparent-size $localfailpath; else echo '-1 -1 -1'; fi` )
111 wue=( `ssh operator@coma.astro.uni-wuerzburg.de "if [ -d $wuerawpath ]; then ls $wuerawpath/* | wc -l; du -s -b --apparent-size $wuerawpath; else echo '-1 -1 -1'; fi"` )
112 #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"` )
113 query="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM RunInfo WHERE fNight="$date2
114 querystart="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM "
115 queryjoin="LEFT JOIN RunInfo USING(fNight,fRunID) "
116 querywhere="WHERE fNight="$date2" AND NOT ISNULL(fStartTime) AND NOT ISNULL(fStopTime) AND ISNULL(fReturnCode)"
117 numruns=`sendquery`
118 if [ "$numruns" == "" ]
119 then
120 numruns=0
121 fi
122 query=$querystart"RawFileRsyncedISDCStatus "$queryjoin" "$querywhere
123 numrsynced=`sendquery`
124 if [ "$numrsynced" == "" ]
125 then
126 numrsynced=0
127 fi
128 query=$querystart"RawFileAvailISDCStatus "$queryjoin" "$querywhere
129 numisdc=`sendquery`
130 if [ "$numisdc" == "" ]
131 then
132 numisdc=0
133 fi
134 query=$querystart"RawFileAvailWueStatus "$queryjoin" "$querywhere
135 numwue=`sendquery`
136 if [ "$numwue" == "" ]
137 then
138 numwue=0
139 fi
140 #query=$querystart"RawFileAvailPhidoStatus "$queryjoin" "$querywhere
141 #numphido=`sendquery`
142 #if [ "$numphido" == "" ]
143 #then
144 # numphido=0
145 #fi
146 echo "disk: "
147 echo " newdaq "${newdaq[@]}
148 echo " daq "${daq[@]}
149 echo " data "${zip[@]}
150 echo " dl00 "${dl00[@]}
151 echo " wue "${wue[@]}
152 echo " arch "${archive[@]}
153 echo " fail "${fails[@]}
154 #echo " phido "${phido[@]}
155 echo "db: "
156 echo " runinfo "$numruns
157 echo " rsynced "$numrsynced
158 echo " isdc "$numisdc
159 echo " wue "$numwue
160 #echo " phido "$numphido
161
162 # check if file are available in the different places
163 if [ ${dl00[0]} -eq -1 ] && [ $date2 -lt 20120308 ]
164 then
165 echo "INFO data not available on /scratch on dl00 for "$date
166 fi
167 if [ ${archive[0]} -eq -1 ]
168 then
169 echo "INFO data not in archive for "$date
170 fi
171
172 # check if number of files agree in the different places
173 # lp
174 if ! [ ${daq[0]} -eq -1 ] && ! [ ${daq[0]} -eq ${newdaq[0]} ]
175 then
176 echo "WARN number of files on daq (" ${daq[0]}") does not agree with number of files on newdaq (" ${newdaq[0]}") for "$date
177 numpb=`echo " $numpb + 1 " | bc -l `
178 result="1"
179 else
180 numok=`echo " $numok + 1 " | bc -l `
181 result="0"
182 fi
183 # dl00
184 if ! [ ${dl00[0]} -eq -1 ] && ! [ ${dl00[0]} -eq ${newdaq[0]} ]
185 then
186 echo "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
187 numpb=`echo " $numpb + 1 " | bc -l `
188 result=$result"1"
189 else
190 numok=`echo " $numok + 1 " | bc -l `
191 result=$result"0"
192 fi
193 # archive
194 if ! [ ${archive[0]} -eq -1 ] && ! [ ${archive[0]} -eq ${newdaq[0]} ]
195 then
196 echo "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
197 #check /archive/rev_1/failed
198 if ! [ ${fails[0]} -eq -1 ]
199 then
200 sum=`echo " ${fails[0]} + ${archive[0]} " | bc -l `
201 if ! [ $sum -eq ${newdaq[0]} ]
202 then
203 echo "ERROR number of files in whole archive ("$sum") is different from number of files in La Palma ("${newdaq[0]}")."
204 numpb=`echo " $numpb + 1 " | bc -l `
205 result=$result"1"
206 else
207 numok=`echo " $numok + 1 " | bc -l `
208 result=$result"0"
209 fi
210 else
211 result=$result"1"
212 fi
213 else
214 if [ ${archive[0]} -eq -1 ]
215 then
216 numpb=`echo " $numpb + 1 " | bc -l `
217 result=$result"1"
218 else
219 numok=`echo " $numok + 1 " | bc -l `
220 result=$result"0"
221 fi
222 fi
223 # wue
224 if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${newdaq[0]} ]
225 then
226 echo "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
227 numpb=`echo " $numpb + 1 " | bc -l `
228 result=$result"1"
229 else
230 numok=`echo " $numok + 1 " | bc -l `
231 result=$result"0"
232 fi
233 ## phido
234 #if ! [ ${phido[0]} -eq -1 ] && ! [ ${phido[0]} -eq ${newdaq[0]} ]
235 #then
236 # echo "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
237 # numpb=`echo " $numpb + 1 " | bc -l `
238 # result=$result"1"
239 #else
240 # numok=`echo " $numok + 1 " | bc -l `
241 # result=$result"0"
242 #fi
243
244 if [ "$short" = "yes" ] || [ "$result" != "0000" ]
245 then
246 echo $result
247 continue
248 fi
249
250 result=$result"-"
251 # check du for raw files
252 # la palma
253 if ! [ ${newdaq[1]} -eq ${daq[1]} ]
254 then
255 echo "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and daq ("${daq[1]}") for "$date
256 numdiff=`echo " $numdiff + 1 " | bc -l `
257 numpb=`echo " $numpb + 1 " | bc -l `
258 result=$result"1"
259 else
260 numok=`echo " $numok + 1 " | bc -l `
261 result=$result"0"
262 fi
263 # check du for zipped raw files
264 # dl00
265 if ! [ ${zip[1]} -eq ${dl00[1]} ] && [ $date2 -gt 20120307 ]
266 then
267 echo "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date
268 if ! [ ${dl00[1]} -eq -1 ]
269 then
270 numdiff=`echo " $numdiff + 1 " | bc -l `
271 numpb=`echo " $numpb + 1 " | bc -l `
272 result=$result"1"
273 else
274 numok=`echo " $numok + 1 " | bc -l `
275 result=$result"0"
276 fi
277 else
278 numok=`echo " $numok + 1 " | bc -l `
279 result=$result"0"
280 fi
281 # archive
282 if ! [ ${zip[1]} -eq ${archive[1]} ]
283 then
284 echo "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date
285 if ! [ ${archive[1]} -eq -1 ]
286 then
287 numdiff=`echo " $numdiff + 1 " | bc -l `
288 numpb=`echo " $numpb + 1 " | bc -l `
289 result=$result"1"
290 else
291 numok=`echo " $numok + 1 " | bc -l `
292 result=$result"0"
293 fi
294 else
295 numok=`echo " $numok + 1 " | bc -l `
296 result=$result"0"
297 fi
298 # wue
299 if ! [ ${zip[1]} -eq ${wue[1]} ]
300 then
301 echo "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date
302 if ! [ ${wue[1]} -eq -1 ]
303 then
304 numdiff=`echo " $numdiff + 1 " | bc -l `
305 numpb=`echo " $numpb + 1 " | bc -l `
306 result=$result"1"
307 else
308 numok=`echo " $numok + 1 " | bc -l `
309 result=$result"0"
310 fi
311 else
312 numok=`echo " $numok + 1 " | bc -l `
313 result=$result"0"
314 fi
315 ## phido
316 #if ! [ ${zip[1]} -eq ${phido[1]} ]
317 #then
318 # echo "WARN size of data doesn't agree on data ("${zip[1]}") and on Phido ("${phido[1]}") for "$date
319 # if ! [ ${phido[1]} -eq -1 ]
320 # then
321 # numdiff=`echo " $numdiff + 1 " | bc -l `
322 # numpb=`echo " $numpb + 1 " | bc -l `
323 # result=$result"1"
324 # else
325 # numok=`echo " $numok + 1 " | bc -l `
326 # result=$result"0"
327 # fi
328 #else
329 # numok=`echo " $numok + 1 " | bc -l `
330 # result=$result"0"
331 #fi
332 result=$result"-"
333
334 # check DB (only starting from 8.3.2012) (if-clause to be removed later)
335 if [ $date2 -gt 20120307 ]
336 then
337 # lp
338 if ! [ $numruns -eq ${newdaq[0]} ]
339 then
340 echo "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns")"
341 numpb=`echo " $numpb + 1 " | bc -l `
342 result=$result"1"
343 else
344 numok=`echo " $numok + 1 " | bc -l `
345 result=$result"0"
346 fi
347 # dl00
348 if ! [ $numruns -eq $numrsynced ]
349 then
350 echo "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")"
351 numpb=`echo " $numpb + 1 " | bc -l `
352 result=$result"1"
353 else
354 numok=`echo " $numok + 1 " | bc -l `
355 result=$result"0"
356 fi
357 # archive
358 if ! [ $numruns -eq $numisdc ]
359 then
360 echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")"
361 numpb=`echo " $numpb + 1 " | bc -l `
362 result=$result"1"
363 else
364 numok=`echo " $numok + 1 " | bc -l `
365 result=$result"0"
366 fi
367 # wue
368 if ! [ $numruns -eq $numwue ]
369 then
370 echo "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")"
371 numpb=`echo " $numpb + 1 " | bc -l `
372 result=$result"1"
373 else
374 numok=`echo " $numok + 1 " | bc -l `
375 result=$result"0"
376 fi
377 ## phido
378 #if ! [ $numruns -eq $numphido ]
379 #then
380 # echo "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")"
381 # numpb=`echo " $numpb + 1 " | bc -l `
382 # result=$result"1"
383 #else
384 # numok=`echo " $numok + 1 " | bc -l `
385 # result=$result"0"
386 #fi
387 fi
388
389 #numdiff=0 # add for debugging so that single file sizes are not checked
390 echo "numdiff: "$numdiff
391 echo "INFO numok: "$numok
392 echo "INFO numpb: "$numpb
393 #if [ $numdiff -gt 0 ]
394 if [ $numdiff -ge 0 ]
395 then
396 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2
397 runs=( `sendquery` )
398 archivediffcounter=0
399 archiveokcounter=0
400 wuediffcounter=0
401 wueokcounter=0
402 #phidodiffcounter=0
403 #phidookcounter=0
404 dl00diffcounter=0
405 dl00okcounter=0
406 daqdiffcounter=0
407 daqokcounter=0
408 echo "INFO found "${#runs[@]}" rawfiles in DB."
409 for run in ${runs[@]}
410 do
411 rawfile=$date2"_"`printf %03d $run`".fits"
412 rawfile2=$rawfile".gz"
413
414 # get file sizes for run
415 sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
416 sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
417 sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
418 if ! [ ${dl00[1]} -eq -1 ]
419 then
420 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
421 fi
422 if ! [ ${archive[1]} -eq -1 ]
423 then
424 sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
425 fi
426 if ! [ ${fails[1]} -eq -1 ]
427 then
428 sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
429 fi
430 if ! [ ${wue[1]} -eq -1 ]
431 then
432 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
433 fi
434# echo "vgl "$run": "$sizezip" - "$sizearchive
435 #if ! [ ${phido[1]} -eq -1 ]
436 #then
437 # 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 }'"` )
438 #fi
439
440 # check file sizes for run
441 # lp
442 if ! [ "$sizenewdaq" = "$sizedaq" ]
443 then
444 echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
445 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
446 else
447 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
448 fi
449 # dl00
450 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
451 then
452 echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
453 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
454 else
455 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
456 fi
457 # archive
458 #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
459 #if [ ${archive[1]} -ne -1 ] && [ "$sizezip" != "$sizearchive" -o "$sizezip" != "$sizefails" ]
460 if [ ${archive[1]} -ne -1 -a "$sizezip" != "$sizearchive" -a "$sizezip" != "$sizefails" ]
461 then
462 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
463 echo " "$sizezip"-"$sizearchive"-"${archive[1]}"-"$sizezip"-"$sizefails"-"${fails[1]}
464 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
465 else
466 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
467 fi
468 # wue
469 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
470 then
471 echo " "$rawfile2" data("$sizezip") wue("$sizewue")"
472 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
473 else
474 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
475 fi
476 ## phido
477 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
478 #then
479 # echo " "$rawfile2" data("$sizezip") phido("$sizephido")"
480 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
481 #else
482 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
483 #fi
484 done
485 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
486 drsruns=( `sendquery` )
487 echo "INFO found "${#drsruns[@]}" drsfiles in DB."
488 for drsrun in ${drsruns[@]}
489 do
490 rawfile=$date2"_"`printf %03d $drsrun`".drs.fits"
491 rawfile2=$rawfile".gz"
492 # get file sizes for run
493 sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
494 sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
495 sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
496 if ! [ ${dl00[1]} -eq -1 ]
497 then
498 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
499 fi
500 if ! [ ${archive[1]} -eq -1 ]
501 then
502 sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
503 fi
504 if ! [ ${fails[1]} -eq -1 ]
505 then
506 sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
507 fi
508 if ! [ ${wue[1]} -eq -1 ]
509 then
510 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
511 fi
512 #if ! [ ${phido[1]} -eq -1 ]
513 #then
514 # 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 }'"` )
515 #fi
516
517 # check file sizes for run
518 # lp
519 if ! [ "$sizenewdaq" = "$sizedaq" ]
520 then
521 echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
522 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
523 else
524 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
525 fi
526 # dl00
527 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
528 then
529 echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
530 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
531 else
532 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
533 fi
534 #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
535 if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ]
536 then
537 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
538 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
539 else
540 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
541 fi
542 # wue
543 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
544 then
545 echo " "$rawfile2" data("$sizezip") wue("$sizewue")"
546 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
547 else
548 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
549 fi
550 ## phido
551 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
552 #then
553 # echo " "$rawfile2" data("$sizezip") phido("$sizephido")"
554 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
555 #else
556 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
557 #fi
558 done
559
560 result=$result"-"
561 # raw files
562 if [ $daqokcounter -eq ${daq[0]} ]
563 then
564 numok=`echo " $numok + 1 " | bc -l `
565 result=$result"0"
566 else
567 result=$result"1"
568 numpb=`echo " $numpb + 1 " | bc -l `
569 fi
570 # zipped files
571 # dl00
572 if [ $dl00okcounter -eq ${dl00[0]} ]
573 then
574 result=$result"0"
575 numok=`echo " $numok + 1 " | bc -l `
576 else
577 result=$result"1"
578 numpb=`echo " $numpb + 1 " | bc -l `
579 fi
580 # archive
581 # daq had been used, because archive[0] doesn't include fails[0]
582 #if [ $archiveokcounter -eq ${newdaq[0]} ]
583 # archive[0] had been used, because newdaq[0] might be empty
584 # in case the data was taken on data
585 #if [ $archiveokcounter -eq ${archive[0]} ]
586 # compare with daq[0] as there should be always data on data
587 if [ $archiveokcounter -eq ${daq[0]} ]
588 then
589 result=$result"0"
590 numok=`echo " $numok + 1 " | bc -l `
591 else
592 result=$result"1"
593 numpb=`echo " $numpb + 1 " | bc -l `
594 fi
595 # wue
596 if [ $wueokcounter -eq ${wue[0]} ]
597 then
598 result=$result"0"
599 numok=`echo " $numok + 1 " | bc -l `
600 else
601 result=$result"1"
602 numpb=`echo " $numpb + 1 " | bc -l `
603 fi
604 ## phido
605 #if [ $phidookcounter -eq ${phido[0]} ]
606 #then
607 # result=$result"0"
608 # numok=`echo " $numok + 1 " | bc -l `
609 #else
610 # result=$result"1"
611 # numpb=`echo " $numpb + 1 " | bc -l `
612 #fi
613 echo "INFO "$daqokcounter" files are ok on daq (raw)."
614 echo "INFO "$dl00okcounter" files are ok on dl00."
615 echo "INFO "$wueokcounter" files are ok in Wue."
616 echo "INFO "$archiveokcounter" files are ok in the archive."
617 #echo "INFO "$phidookcounter" files are ok on Phido."
618 echo "WARN "$daqdiffcounter" files have a different size on daq (raw)."
619 echo "WARN "$dl00diffcounter" files have a different size on dl00."
620 echo "WARN "$wuediffcounter" files have a different size in Wue."
621 echo "WARN "$archivediffcounter" files have a different size in the archive."
622 #echo "WARN "$phidodiffcounter" files have a different size on Phido."
623 fi
624
625 # print summary:
626 echo "INFO day ok: "$numdaysok
627 echo "INFO numok: "$numok
628 echo "INFO numpb: "$numpb
629 echo "result:"
630 echo "(#files-dudir-db-filesize)"
631 #echo " ldawp-ldawp-ldawp-ldawp"
632 echo " ldaw-ldaw-ldaw-ldaw"
633 echo " "$result
634 sumdatanew=`echo " ( ${daq[1]} + ${zip[1]} ) / 1024 / 1024 / 1024 " | bc -l | cut -d. -f1`
635 sumdata=`echo " $sumdata + $sumdatanew " | bc -l | cut -d. -f1`
636 echo "checked alread "$sumdata" GB. "$sumdatanew" "${daq[1]}" "${zip[1]}
637 if [ $numpb -lt 4 ]
638 then
639 numdaysok=`echo " $numdaysok + 1 " | bc -l `
640 fi
641done
642
643printprocesslog "INFO finished $0"
644
Note: See TracBrowser for help on using the repository browser.