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

Last change on this file since 15065 was 14824, checked in by Daniela Dorner, 12 years ago
updated to changes in LP (newdaq), implemented PhiDo (still commented), added checking of DB for crashed and failed transfer processes
  • Property svn:executable set to *
File size: 23.7 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 -3 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=( "2012/09/22" )
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 numok=`echo " $numok + 1 " | bc -l `
215 result=$result"0"
216 fi
217 # wue
218 if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${newdaq[0]} ]
219 then
220 echo "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
221 numpb=`echo " $numpb + 1 " | bc -l `
222 result=$result"1"
223 else
224 numok=`echo " $numok + 1 " | bc -l `
225 result=$result"0"
226 fi
227 ## phido
228 #if ! [ ${phido[0]} -eq -1 ] && ! [ ${phido[0]} -eq ${newdaq[0]} ]
229 #then
230 # echo "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
231 # numpb=`echo " $numpb + 1 " | bc -l `
232 # result=$result"1"
233 #else
234 # numok=`echo " $numok + 1 " | bc -l `
235 # result=$result"0"
236 #fi
237
238 if [ "$short" = "yes" ]
239 then
240 continue
241 fi
242
243 result=$result"-"
244 # check du for raw files
245 # la palma
246 if ! [ ${newdaq[1]} -eq ${daq[1]} ]
247 then
248 echo "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and daq ("${daq[1]}") for "$date
249 numdiff=`echo " $numdiff + 1 " | bc -l `
250 numpb=`echo " $numpb + 1 " | bc -l `
251 result=$result"1"
252 else
253 numok=`echo " $numok + 1 " | bc -l `
254 result=$result"0"
255 fi
256 # check du for zipped raw files
257 # dl00
258 if ! [ ${zip[1]} -eq ${dl00[1]} ] && [ $date2 -gt 20120307 ]
259 then
260 echo "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date
261 if ! [ ${dl00[1]} -eq -1 ]
262 then
263 numdiff=`echo " $numdiff + 1 " | bc -l `
264 numpb=`echo " $numpb + 1 " | bc -l `
265 result=$result"1"
266 else
267 numok=`echo " $numok + 1 " | bc -l `
268 result=$result"0"
269 fi
270 else
271 numok=`echo " $numok + 1 " | bc -l `
272 result=$result"0"
273 fi
274 # archive
275 if ! [ ${zip[1]} -eq ${archive[1]} ]
276 then
277 echo "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date
278 if ! [ ${archive[1]} -eq -1 ]
279 then
280 numdiff=`echo " $numdiff + 1 " | bc -l `
281 numpb=`echo " $numpb + 1 " | bc -l `
282 result=$result"1"
283 else
284 numok=`echo " $numok + 1 " | bc -l `
285 result=$result"0"
286 fi
287 else
288 numok=`echo " $numok + 1 " | bc -l `
289 result=$result"0"
290 fi
291 # wue
292 if ! [ ${zip[1]} -eq ${wue[1]} ]
293 then
294 echo "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date
295 if ! [ ${wue[1]} -eq -1 ]
296 then
297 numdiff=`echo " $numdiff + 1 " | bc -l `
298 numpb=`echo " $numpb + 1 " | bc -l `
299 result=$result"1"
300 else
301 numok=`echo " $numok + 1 " | bc -l `
302 result=$result"0"
303 fi
304 else
305 numok=`echo " $numok + 1 " | bc -l `
306 result=$result"0"
307 fi
308 ## phido
309 #if ! [ ${zip[1]} -eq ${phido[1]} ]
310 #then
311 # echo "WARN size of data doesn't agree on data ("${zip[1]}") and on Phido ("${phido[1]}") for "$date
312 # if ! [ ${phido[1]} -eq -1 ]
313 # then
314 # numdiff=`echo " $numdiff + 1 " | bc -l `
315 # numpb=`echo " $numpb + 1 " | bc -l `
316 # result=$result"1"
317 # else
318 # numok=`echo " $numok + 1 " | bc -l `
319 # result=$result"0"
320 # fi
321 #else
322 # numok=`echo " $numok + 1 " | bc -l `
323 # result=$result"0"
324 #fi
325 result=$result"-"
326
327 # check DB (only starting from 8.3.2012) (if-clause to be removed later)
328 if [ $date2 -gt 20120307 ]
329 then
330 # lp
331 if ! [ $numruns -eq ${newdaq[0]} ]
332 then
333 echo "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns")"
334 numpb=`echo " $numpb + 1 " | bc -l `
335 result=$result"1"
336 else
337 numok=`echo " $numok + 1 " | bc -l `
338 result=$result"0"
339 fi
340 # dl00
341 if ! [ $numruns -eq $numrsynced ]
342 then
343 echo "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")"
344 numpb=`echo " $numpb + 1 " | bc -l `
345 result=$result"1"
346 else
347 numok=`echo " $numok + 1 " | bc -l `
348 result=$result"0"
349 fi
350 # archive
351 if ! [ $numruns -eq $numisdc ]
352 then
353 echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")"
354 numpb=`echo " $numpb + 1 " | bc -l `
355 result=$result"1"
356 else
357 numok=`echo " $numok + 1 " | bc -l `
358 result=$result"0"
359 fi
360 # wue
361 if ! [ $numruns -eq $numwue ]
362 then
363 echo "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")"
364 numpb=`echo " $numpb + 1 " | bc -l `
365 result=$result"1"
366 else
367 numok=`echo " $numok + 1 " | bc -l `
368 result=$result"0"
369 fi
370 ## phido
371 #if ! [ $numruns -eq $numphido ]
372 #then
373 # echo "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")"
374 # numpb=`echo " $numpb + 1 " | bc -l `
375 # result=$result"1"
376 #else
377 # numok=`echo " $numok + 1 " | bc -l `
378 # result=$result"0"
379 #fi
380 fi
381
382 #numdiff=0 # add for debugging so that single file sizes are not checked
383 echo "numdiff: "$numdiff
384 echo "INFO numok: "$numok
385 echo "INFO numpb: "$numpb
386 #if [ $numdiff -gt 0 ]
387 if [ $numdiff -ge 0 ]
388 then
389 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2
390 runs=( `sendquery` )
391 archivediffcounter=0
392 archiveokcounter=0
393 wuediffcounter=0
394 wueokcounter=0
395 #phidodiffcounter=0
396 #phidookcounter=0
397 dl00diffcounter=0
398 dl00okcounter=0
399 daqdiffcounter=0
400 daqokcounter=0
401 echo "INFO found "${#runs[@]}" rawfiles in DB."
402 for run in ${runs[@]}
403 do
404 rawfile=$date2"_"`printf %03d $run`".fits"
405 rawfile2=$rawfile".gz"
406
407 # get file sizes for run
408 sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
409 sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
410 sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
411 if ! [ ${dl00[1]} -eq -1 ]
412 then
413 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
414 fi
415 if ! [ ${archive[1]} -eq -1 ]
416 then
417 sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
418 fi
419 if ! [ ${fails[1]} -eq -1 ]
420 then
421 sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
422 fi
423 if ! [ ${wue[1]} -eq -1 ]
424 then
425 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
426 fi
427# echo "vgl "$run": "$sizezip" - "$sizearchive
428 #if ! [ ${phido[1]} -eq -1 ]
429 #then
430 # 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 }'"` )
431 #fi
432
433 # check file sizes for run
434 # lp
435 if ! [ "$sizenewdaq" = "$sizedaq" ]
436 then
437 echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
438 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
439 else
440 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
441 fi
442 # dl00
443 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
444 then
445 echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
446 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
447 else
448 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
449 fi
450 # archive
451 #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
452 #if [ ${archive[1]} -ne -1 ] && [ "$sizezip" != "$sizearchive" -o "$sizezip" != "$sizefails" ]
453 if [ ${archive[1]} -ne -1 -a "$sizezip" != "$sizearchive" -a "$sizezip" != "$sizefails" ]
454 then
455 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
456 echo " "$sizezip"-"$sizearchive"-"${archive[1]}"-"$sizezip"-"$sizefails"-"${fails[1]}
457 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
458 else
459 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
460 fi
461 # wue
462 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
463 then
464 echo " "$rawfile2" data("$sizezip") wue("$sizewue")"
465 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
466 else
467 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
468 fi
469 ## phido
470 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
471 #then
472 # echo " "$rawfile2" data("$sizezip") phido("$sizephido")"
473 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
474 #else
475 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
476 #fi
477 done
478 query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
479 drsruns=( `sendquery` )
480 echo "INFO found "${#drsruns[@]}" drsfiles in DB."
481 for drsrun in ${drsruns[@]}
482 do
483 rawfile=$date2"_"`printf %03d $drsrun`".drs.fits"
484 rawfile2=$rawfile".gz"
485 # get file sizes for run
486 sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
487 sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
488 sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
489 if ! [ ${dl00[1]} -eq -1 ]
490 then
491 sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
492 fi
493 if ! [ ${archive[1]} -eq -1 ]
494 then
495 sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
496 fi
497 if ! [ ${fails[1]} -eq -1 ]
498 then
499 sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
500 fi
501 if ! [ ${wue[1]} -eq -1 ]
502 then
503 sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
504 fi
505 #if ! [ ${phido[1]} -eq -1 ]
506 #then
507 # 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 }'"` )
508 #fi
509
510 # check file sizes for run
511 # lp
512 if ! [ "$sizenewdaq" = "$sizedaq" ]
513 then
514 echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
515 daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
516 else
517 daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
518 fi
519 # dl00
520 if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
521 then
522 echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
523 dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
524 else
525 dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
526 fi
527 #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
528 if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ]
529 then
530 echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
531 archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
532 else
533 archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
534 fi
535 # wue
536 if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
537 then
538 echo " "$rawfile2" data("$sizezip") wue("$sizewue")"
539 wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
540 else
541 wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
542 fi
543 ## phido
544 #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
545 #then
546 # echo " "$rawfile2" data("$sizezip") phido("$sizephido")"
547 # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
548 #else
549 # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
550 #fi
551 done
552
553 result=$result"-"
554 # raw files
555 if [ $daqokcounter -eq ${daq[0]} ]
556 then
557 numok=`echo " $numok + 1 " | bc -l `
558 result=$result"0"
559 else
560 result=$result"1"
561 numpb=`echo " $numpb + 1 " | bc -l `
562 fi
563 # zipped files
564 # dl00
565 if [ $dl00okcounter -eq ${dl00[0]} ]
566 then
567 result=$result"0"
568 numok=`echo " $numok + 1 " | bc -l `
569 else
570 result=$result"1"
571 numpb=`echo " $numpb + 1 " | bc -l `
572 fi
573 # archive
574 # daq had been used, because archive[0] doesn't include fails[0]
575 #if [ $archiveokcounter -eq ${newdaq[0]} ]
576 # archive[0] had been used, because newdaq[0] might be empty
577 # in case the data was taken on data
578 #if [ $archiveokcounter -eq ${archive[0]} ]
579 # compare with daq[0] as there should be always data on data
580 if [ $archiveokcounter -eq ${daq[0]} ]
581 then
582 result=$result"0"
583 numok=`echo " $numok + 1 " | bc -l `
584 else
585 result=$result"1"
586 numpb=`echo " $numpb + 1 " | bc -l `
587 fi
588 # wue
589 if [ $wueokcounter -eq ${wue[0]} ]
590 then
591 result=$result"0"
592 numok=`echo " $numok + 1 " | bc -l `
593 else
594 result=$result"1"
595 numpb=`echo " $numpb + 1 " | bc -l `
596 fi
597 ## phido
598 #if [ $phidookcounter -eq ${phido[0]} ]
599 #then
600 # result=$result"0"
601 # numok=`echo " $numok + 1 " | bc -l `
602 #else
603 # result=$result"1"
604 # numpb=`echo " $numpb + 1 " | bc -l `
605 #fi
606 echo "INFO "$daqokcounter" files are ok on daq (raw)."
607 echo "INFO "$dl00okcounter" files are ok on dl00."
608 echo "INFO "$wueokcounter" files are ok in Wue."
609 echo "INFO "$archiveokcounter" files are ok in the archive."
610 #echo "INFO "$phidookcounter" files are ok on Phido."
611 echo "WARN "$daqdiffcounter" files have a different size on daq (raw)."
612 echo "WARN "$dl00diffcounter" files have a different size on dl00."
613 echo "WARN "$wuediffcounter" files have a different size in Wue."
614 echo "WARN "$archivediffcounter" files have a different size in the archive."
615 #echo "WARN "$phidodiffcounter" files have a different size on Phido."
616 fi
617
618 # print summary:
619 echo "INFO day ok: "$numdaysok
620 echo "INFO numok: "$numok
621 echo "INFO numpb: "$numpb
622 echo "result:"
623 echo "(#files-dudir-db-filesize)"
624 #echo " ldawp-ldawp-ldawp-ldawp"
625 echo " ldaw-ldaw-ldaw-ldaw"
626 echo " "$result
627 sumdatanew=`echo " ( ${daq[1]} + ${zip[1]} ) / 1024 / 1024 / 1024 " | bc -l | cut -d. -f1`
628 sumdata=`echo " $sumdata + $sumdatanew " | bc -l | cut -d. -f1`
629 echo "checked alread "$sumdata" GB. "$sumdatanew" "${daq[1]}" "${zip[1]}
630 if [ $numpb -lt 4 ]
631 then
632 numdaysok=`echo " $numdaysok + 1 " | bc -l `
633 fi
634done
635
636printprocesslog "INFO finished $0"
637
Note: See TracBrowser for help on using the repository browser.