1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # This script checks whether data can be deleted
|
---|
4 | #
|
---|
5 |
|
---|
6 | source `dirname $0`/../Sourcefile.sh
|
---|
7 | printprocesslog "INFO starting $0"
|
---|
8 |
|
---|
9 | # get last 10 nights (skip current night)
|
---|
10 | dates=( `date +%Y/%m/%d --date="-360hour"` `date +%Y/%m/%d --date="-336hour"` `date +%Y/%m/%d --date="-312hour"` \
|
---|
11 | `date +%Y/%m/%d --date="-288hour"` `date +%Y/%m/%d --date="-264hour"` `date +%Y/%m/%d --date="-240hour"` \
|
---|
12 | `date +%Y/%m/%d --date="-216hour"` `date +%Y/%m/%d --date="-192hour"` `date +%Y/%m/%d --date="-168hour"` \
|
---|
13 | `date +%Y/%m/%d --date="-144hour"` `date +%Y/%m/%d --date="-120hour"` `date +%Y/%m/%d --date="-96hour"` \
|
---|
14 | `date +%Y/%m/%d --date="-72hour"` `date +%Y/%m/%d --date="-48hour"` `date +%Y/%m/%d --date="-24hour"` \
|
---|
15 | )
|
---|
16 |
|
---|
17 | numdaysok=0
|
---|
18 | numdaysoklimit=1
|
---|
19 | for date in ${dates[@]}
|
---|
20 | do
|
---|
21 | echo ""
|
---|
22 | echo ""
|
---|
23 | echo ""
|
---|
24 | echo $date
|
---|
25 |
|
---|
26 | # some counters
|
---|
27 | numdiff=0
|
---|
28 | numok=0
|
---|
29 | numpb=0
|
---|
30 |
|
---|
31 | # check always only $numdaysoklimit days
|
---|
32 | if [ $numdaysok -ge $numdaysoklimit ]
|
---|
33 | then
|
---|
34 | echo "INFO more than "$numdaysoklimit" ok -> stop. "
|
---|
35 | continue
|
---|
36 | fi
|
---|
37 |
|
---|
38 | # get paths
|
---|
39 | date2=`echo $date | sed -e 's/\///g'`
|
---|
40 | lprawpath="/daq/raw/"$date
|
---|
41 | lprawpath2="/loc_data/raw/"$date
|
---|
42 | lpziprawpath="/loc_data/zipraw/"$date
|
---|
43 | localrawpath="/scratch/from_lapalma/raw/"$date
|
---|
44 | #localrawpath2="/data00/fact-construction/raw/"$date
|
---|
45 | localrawpath3="/fact/raw/"$date
|
---|
46 | localfailpath="/archive/fact/fails/raw/"$date
|
---|
47 | wuerawpath="/fact/raw/"$date
|
---|
48 |
|
---|
49 | # get disk usage and number of files for directory
|
---|
50 | daq=( `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"` )
|
---|
51 | data=( `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"` )
|
---|
52 | if [ ${daq[0]} -eq -1 ] && [ ${data[0]} -eq -1 ]
|
---|
53 | then
|
---|
54 | echo "INFO no data available on daq for "$date
|
---|
55 | continue
|
---|
56 | fi
|
---|
57 | 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"` )
|
---|
58 | dl00=( `if [ -d $localrawpath ]; then ls $localrawpath/* | wc -l; du -s -b --apparent-size $localrawpath; else echo '-1 -1 -1'; fi` )
|
---|
59 | #data00=( `if [ -d $localrawpath2 ]; then ls $localrawpath2/* | wc -l; du -s -b --apparent-size $localrawpath2; else echo '-1 -1 -1'; fi` )
|
---|
60 | archive=( `if [ -d $localrawpath3 ]; then ls $localrawpath3/* | wc -l; du -s -b --apparent-size $localrawpath3; else echo '-1 -1 -1'; fi` )
|
---|
61 | fails=( `if [ -d $localfailpath ]; then ls $localfailpath/* | wc -l; du -s -b --apparent-size $localfailpath; else echo '-1 -1 -1'; fi` )
|
---|
62 | 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"` )
|
---|
63 | query="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM RunInfo WHERE fNight="$date2
|
---|
64 | querystart="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM "
|
---|
65 | queryjoin="LEFT JOIN RunInfo USING(fNight,fRunID) "
|
---|
66 | querywhere="WHERE fNight="$date2" AND NOT ISNULL(fStartTime) AND NOT ISNULL(fStopTime) AND ISNULL(fReturnCode)"
|
---|
67 | numruns=`sendquery`
|
---|
68 | if [ "$numruns" == "" ]
|
---|
69 | then
|
---|
70 | numruns=0
|
---|
71 | fi
|
---|
72 | query=$querystart"RawFileRsyncedISDCStatus "$queryjoin" "$querywhere
|
---|
73 | numrsynced=`sendquery`
|
---|
74 | if [ "$numrsynced" == "" ]
|
---|
75 | then
|
---|
76 | numrsynced=0
|
---|
77 | fi
|
---|
78 | query=$querystart"RawFileAvailISDCStatus "$queryjoin" "$querywhere
|
---|
79 | numisdc=`sendquery`
|
---|
80 | if [ "$numisdc" == "" ]
|
---|
81 | then
|
---|
82 | numisdc=0
|
---|
83 | fi
|
---|
84 | query=$querystart"RawFileAvailWueStatus "$queryjoin" "$querywhere
|
---|
85 | numwue=`sendquery`
|
---|
86 | if [ "$numwue" == "" ]
|
---|
87 | then
|
---|
88 | numwue=0
|
---|
89 | fi
|
---|
90 | echo " daq "${daq[@]}
|
---|
91 | echo " data "${data[@]}
|
---|
92 | echo " zip "${zip[@]}
|
---|
93 | #if [ $date2 -gt 20120307 ]
|
---|
94 | #then
|
---|
95 | echo " dl00 "${dl00[@]}
|
---|
96 | #else
|
---|
97 | # echo " data00 "${data00[@]}
|
---|
98 | #fi
|
---|
99 | echo " arch "${archive[@]}
|
---|
100 | echo " fail "${fails[@]}
|
---|
101 | echo " wue "${wue[@]}
|
---|
102 | echo " runinfo "$numruns
|
---|
103 | echo " rsynced "$numrsynced
|
---|
104 | echo " isdc "$numisdc
|
---|
105 | echo " wue "$numwue
|
---|
106 |
|
---|
107 | # check if file are available in the different places
|
---|
108 | if [ ${dl00[0]} -eq -1 ] && [ $date2 -lt 20120308 ]
|
---|
109 | then
|
---|
110 | echo "INFO data not available on /scratch on dl00 for "$date
|
---|
111 | fi
|
---|
112 | #if [ ${data00[0]} -eq -1 ] && [ $date2 -gt 20120307 ]
|
---|
113 | #then
|
---|
114 | # echo "INFO data not available on /data00 for "$date
|
---|
115 | #fi
|
---|
116 | if [ ${archive[0]} -eq -1 ]
|
---|
117 | then
|
---|
118 | echo "INFO data not in archive for "$date
|
---|
119 | fi
|
---|
120 |
|
---|
121 | # check if number of files agree in the different places
|
---|
122 | # archive
|
---|
123 | if ! [ ${archive[0]} -eq -1 ] && ! [ ${archive[0]} -eq ${daq[0]} ]
|
---|
124 | then
|
---|
125 | echo "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${daq[0]}") for "$date
|
---|
126 | #check /archive/rev_1/failed
|
---|
127 | if ! [ ${fails[0]} -eq -1 ]
|
---|
128 | then
|
---|
129 | sum=`echo " ${fails[0]} + ${archive[0]} " | bc -l `
|
---|
130 | if ! [ $sum -eq ${daq[0]} ]
|
---|
131 | then
|
---|
132 | echo "ERROR number of files in archive ("$sum") is different from number of files in La Palma ("${daq[0]}")."
|
---|
133 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
134 | result="1"
|
---|
135 | else
|
---|
136 | numok=`echo " $numok + 1 " | bc -l `
|
---|
137 | result="0"
|
---|
138 | fi
|
---|
139 | else
|
---|
140 | result="1"
|
---|
141 | fi
|
---|
142 | else
|
---|
143 | numok=`echo " $numok + 1 " | bc -l `
|
---|
144 | result="0"
|
---|
145 | fi
|
---|
146 | # lp
|
---|
147 | if ! [ ${data[0]} -eq -1 ] && ! [ ${data[0]} -eq ${daq[0]} ]
|
---|
148 | then
|
---|
149 | echo "WARN number of files on data (" ${data[0]}") does not agree with number of files on daq (" ${daq[0]}") for "$date
|
---|
150 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
151 | result=$result"1"
|
---|
152 | else
|
---|
153 | numok=`echo " $numok + 1 " | bc -l `
|
---|
154 | result=$result"0"
|
---|
155 | fi
|
---|
156 | # dl00
|
---|
157 | if ! [ ${dl00[0]} -eq -1 ] && ! [ ${dl00[0]} -eq ${daq[0]} ]
|
---|
158 | then
|
---|
159 | echo "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${daq[0]}") for "$date
|
---|
160 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
161 | result=$result"1"
|
---|
162 | else
|
---|
163 | numok=`echo " $numok + 1 " | bc -l `
|
---|
164 | result=$result"0"
|
---|
165 | fi
|
---|
166 | ## /data00 (to be removed later)
|
---|
167 | #if ! [ ${data00[0]} -eq -1 ] && ! [ ${data00[0]} -eq ${daq[0]} ]
|
---|
168 | #then
|
---|
169 | # echo "WARN number of files in /data00 (" ${data00[0]}") does not agree with number of files in LP (" ${daq[0]}") for "$date
|
---|
170 | #fi
|
---|
171 | # wue
|
---|
172 | if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${daq[0]} ]
|
---|
173 | then
|
---|
174 | echo "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${daq[0]}") for "$date
|
---|
175 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
176 | result=$result"1"
|
---|
177 | else
|
---|
178 | numok=`echo " $numok + 1 " | bc -l `
|
---|
179 | result=$result"0"
|
---|
180 | fi
|
---|
181 |
|
---|
182 | result=$result"-"
|
---|
183 | # check du for raw files
|
---|
184 | # la palma
|
---|
185 | if ! [ ${daq[1]} -eq ${data[1]} ]
|
---|
186 | then
|
---|
187 | echo "WARN size of data doesn't agree on daq ("${daq[1]}") and data ("${data[1]}") for "$date
|
---|
188 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
189 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
190 | result=$result"1"
|
---|
191 | else
|
---|
192 | numok=`echo " $numok + 1 " | bc -l `
|
---|
193 | result=$result"0"
|
---|
194 | fi
|
---|
195 | # check du for zipped raw files
|
---|
196 | # dl00
|
---|
197 | if ! [ ${zip[1]} -eq ${dl00[1]} ] && [ $date2 -gt 20120307 ]
|
---|
198 | then
|
---|
199 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date
|
---|
200 | if ! [ ${dl00[1]} -eq -1 ]
|
---|
201 | then
|
---|
202 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
203 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
204 | result=$result"1"
|
---|
205 | else
|
---|
206 | numok=`echo " $numok + 1 " | bc -l `
|
---|
207 | result=$result"0"
|
---|
208 | fi
|
---|
209 | else
|
---|
210 | numok=`echo " $numok + 1 " | bc -l `
|
---|
211 | result=$result"0"
|
---|
212 | fi
|
---|
213 | ## data00 (to be removed later)
|
---|
214 | #if ! [ ${zip[1]} -eq ${data00[1]} ] && [ $date2 -lt 20120308 ]
|
---|
215 | #then
|
---|
216 | # echo "WARN size of data doesn't agree on data ("${zip[1]}") and /data00 ("${data00[1]}") for "$date
|
---|
217 | # if ! [ ${data00[1]} -eq -1 ]
|
---|
218 | # then
|
---|
219 | # numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
220 | # fi
|
---|
221 | #fi
|
---|
222 | # archive
|
---|
223 | if ! [ ${zip[1]} -eq ${archive[1]} ]
|
---|
224 | then
|
---|
225 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date
|
---|
226 | if ! [ ${archive[1]} -eq -1 ]
|
---|
227 | then
|
---|
228 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
229 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
230 | result=$result"1"
|
---|
231 | else
|
---|
232 | numok=`echo " $numok + 1 " | bc -l `
|
---|
233 | result=$result"0"
|
---|
234 | fi
|
---|
235 | else
|
---|
236 | numok=`echo " $numok + 1 " | bc -l `
|
---|
237 | result=$result"0"
|
---|
238 | fi
|
---|
239 | # wue
|
---|
240 | if ! [ ${zip[1]} -eq ${wue[1]} ]
|
---|
241 | then
|
---|
242 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date
|
---|
243 | if ! [ ${wue[1]} -eq -1 ]
|
---|
244 | then
|
---|
245 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
246 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
247 | result=$result"1"
|
---|
248 | else
|
---|
249 | numok=`echo " $numok + 1 " | bc -l `
|
---|
250 | result=$result"0"
|
---|
251 | fi
|
---|
252 | else
|
---|
253 | numok=`echo " $numok + 1 " | bc -l `
|
---|
254 | result=$result"0"
|
---|
255 | fi
|
---|
256 | result=$result"-"
|
---|
257 |
|
---|
258 | # check DB (only starting from 8.3.2012) (if-clause to be removed later)
|
---|
259 | if [ $date2 -gt 20120307 ]
|
---|
260 | then
|
---|
261 | # lp
|
---|
262 | if ! [ $numruns -eq ${daq[0]} ]
|
---|
263 | then
|
---|
264 | echo "WARN number of runs on daq ("${daq[0]}") not equal to number of runs ("$numruns")"
|
---|
265 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
266 | result=$result"1"
|
---|
267 | else
|
---|
268 | numok=`echo " $numok + 1 " | bc -l `
|
---|
269 | result=$result"0"
|
---|
270 | fi
|
---|
271 | # dl00
|
---|
272 | if ! [ $numruns -eq $numrsynced ]
|
---|
273 | then
|
---|
274 | echo "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")"
|
---|
275 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
276 | result=$result"1"
|
---|
277 | else
|
---|
278 | numok=`echo " $numok + 1 " | bc -l `
|
---|
279 | result=$result"0"
|
---|
280 | fi
|
---|
281 | # archive
|
---|
282 | if ! [ $numruns -eq $numisdc ]
|
---|
283 | then
|
---|
284 | echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")"
|
---|
285 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
286 | result=$result"1"
|
---|
287 | else
|
---|
288 | numok=`echo " $numok + 1 " | bc -l `
|
---|
289 | result=$result"0"
|
---|
290 | fi
|
---|
291 | # wue
|
---|
292 | if ! [ $numruns -eq $numwue ]
|
---|
293 | then
|
---|
294 | echo "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")"
|
---|
295 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
296 | result=$result"1"
|
---|
297 | else
|
---|
298 | numok=`echo " $numok + 1 " | bc -l `
|
---|
299 | result=$result"0"
|
---|
300 | fi
|
---|
301 | fi
|
---|
302 |
|
---|
303 | echo "numdiff: "$numdiff
|
---|
304 | echo "INFO numok: "$numok
|
---|
305 | echo "INFO numpb: "$numpb
|
---|
306 | if [ $numdiff -gt 0 ]
|
---|
307 | then
|
---|
308 | query="SELECT fRunID FROM RunInfo WHERE fNight="$date2
|
---|
309 | runs=( `sendquery` )
|
---|
310 | archivediffcounter=0
|
---|
311 | archiveokcounter=0
|
---|
312 | wuediffcounter=0
|
---|
313 | wueokcounter=0
|
---|
314 | dl00diffcounter=0
|
---|
315 | dl00okcounter=0
|
---|
316 | datadiffcounter=0
|
---|
317 | dataokcounter=0
|
---|
318 | echo "INFO found "${#runs[@]}" rawfiles in DB."
|
---|
319 | for run in ${runs[@]}
|
---|
320 | do
|
---|
321 | rawfile=$date2"_"`printf %03d $run`".fits"
|
---|
322 | rawfile2=$rawfile".gz"
|
---|
323 |
|
---|
324 | # get file sizes for run
|
---|
325 | sizedaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
326 | sizedata=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
327 | sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
328 | if ! [ ${dl00[1]} -eq -1 ]
|
---|
329 | then
|
---|
330 | sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
331 | fi
|
---|
332 | #if ! [ ${data00[1]} -eq -1 ]
|
---|
333 | #then
|
---|
334 | # sizedata00=( `ls -l $localrawpath2/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
335 | #fi
|
---|
336 | if ! [ ${archive[1]} -eq -1 ]
|
---|
337 | then
|
---|
338 | sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
339 | fi
|
---|
340 | if ! [ ${fails[1]} -eq -1 ]
|
---|
341 | then
|
---|
342 | sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
343 | fi
|
---|
344 | if ! [ ${wue[1]} -eq -1 ]
|
---|
345 | then
|
---|
346 | sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
347 | fi
|
---|
348 |
|
---|
349 | # check file sizes for run
|
---|
350 | # lp
|
---|
351 | if ! [ "$sizedaq" = "$sizedata" ]
|
---|
352 | then
|
---|
353 | echo " "$rawfile" daq("$sizedaq") data("$sizedata")"
|
---|
354 | datadiffcounter=`echo " $datadiffcounter + 1 " | bc -l `
|
---|
355 | else
|
---|
356 | dataokcounter=`echo " $dataokcounter + 1 " | bc -l `
|
---|
357 | fi
|
---|
358 | # dl00
|
---|
359 | if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
|
---|
360 | then
|
---|
361 | echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
|
---|
362 | dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
|
---|
363 | else
|
---|
364 | dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
|
---|
365 | fi
|
---|
366 | ## data00
|
---|
367 | #if ! [ "$sizezip" = "$sizedata00" ] && ! [ ${data00[1]} -eq -1 ]
|
---|
368 | #then
|
---|
369 | # echo " "$rawfile2" data("$sizezip") data00("$sizedata00")"
|
---|
370 | #fi
|
---|
371 | # archive
|
---|
372 | if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
|
---|
373 | #if ! [ "$sizezip" = "$sizearchive" ] && ! [ ${archive[1]} -eq -1 ]
|
---|
374 | then
|
---|
375 | #echo " --"$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
---|
376 | #if ! [ "$sizezip" = "$sizefails" ] && ! [ ${fails[1]} -eq -1 ]
|
---|
377 | #then
|
---|
378 | echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
---|
379 | archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
|
---|
380 | #else
|
---|
381 | # archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
---|
382 | #fi
|
---|
383 | else
|
---|
384 | archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
---|
385 | fi
|
---|
386 | #if ! [ "$sizezip" = "" ] && ! [ "$sizearchive" = "" ] && ! [ ${archive[1]} -eq -1 ]
|
---|
387 | #then
|
---|
388 | # if [ $sizezip -gt $sizearchive ]
|
---|
389 | # then
|
---|
390 | # echo "ERROR "$rawfile" smaller in archive ("$sizearchive") than on data ("$sizezip")"
|
---|
391 | # fi
|
---|
392 | #fi
|
---|
393 | # wue
|
---|
394 | if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
|
---|
395 | then
|
---|
396 | echo " "$rawfile2" data("$sizezip") wue("$sizewue")"
|
---|
397 | wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
|
---|
398 | else
|
---|
399 | wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
|
---|
400 | fi
|
---|
401 | done
|
---|
402 | query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
|
---|
403 | drsruns=( `sendquery` )
|
---|
404 | echo "INFO found "${#drsruns[@]}" drsfiles in DB."
|
---|
405 | for drsrun in ${drsruns[@]}
|
---|
406 | do
|
---|
407 | rawfile=$date2"_"`printf %03d $run`"drs.fits"
|
---|
408 | rawfile2=$rawfile".gz"
|
---|
409 | # get file sizes for run
|
---|
410 | sizedaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
411 | sizedata=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
412 | sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
413 | if ! [ ${dl00[1]} -eq -1 ]
|
---|
414 | then
|
---|
415 | sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
416 | fi
|
---|
417 | #if ! [ ${data00[1]} -eq -1 ]
|
---|
418 | #then
|
---|
419 | # sizedata00=( `ls -l $localrawpath2/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
420 | #fi
|
---|
421 | if ! [ ${archive[1]} -eq -1 ]
|
---|
422 | then
|
---|
423 | sizearchive=( `ls -l $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
424 | fi
|
---|
425 | if ! [ ${fails[1]} -eq -1 ]
|
---|
426 | then
|
---|
427 | sizefails=( `ls -l $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
428 | fi
|
---|
429 | if ! [ ${wue[1]} -eq -1 ]
|
---|
430 | then
|
---|
431 | sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
432 | fi
|
---|
433 |
|
---|
434 | # check file sizes for run
|
---|
435 | # lp
|
---|
436 | if ! [ "$sizedaq" = "$sizedata" ]
|
---|
437 | then
|
---|
438 | echo " "$rawfile" daq("$sizedaq") data("$sizedata")"
|
---|
439 | datadiffcounter=`echo " $datadiffcounter + 1 " | bc -l `
|
---|
440 | else
|
---|
441 | dataokcounter=`echo " $dataokcounter + 1 " | bc -l `
|
---|
442 | fi
|
---|
443 | # dl00
|
---|
444 | if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
|
---|
445 | then
|
---|
446 | echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")"
|
---|
447 | dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
|
---|
448 | else
|
---|
449 | dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
|
---|
450 | fi
|
---|
451 | ## data00
|
---|
452 | #if ! [ "$sizezip" = "$sizedata00" ] && ! [ ${data00[1]} -eq -1 ]
|
---|
453 | #then
|
---|
454 | # echo " "$rawfile2" data("$sizezip") data00("$sizedata00")"
|
---|
455 | #fi
|
---|
456 | # archive
|
---|
457 | #if [ ! [ "$sizezip" = "$sizearchive" ] && ! [ ${archive[1]} -eq -1 ] ] || [ ! [ "$sizezip" = "$sizefails" ] && ! [ ${fails[1]} -eq -1 ] ]
|
---|
458 | if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
|
---|
459 | then
|
---|
460 | #echo " --"$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
---|
461 | #if
|
---|
462 | #then
|
---|
463 | echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
---|
464 | archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
|
---|
465 | #else
|
---|
466 | # archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
---|
467 | #fi
|
---|
468 | else
|
---|
469 | archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
---|
470 | fi
|
---|
471 | # wue
|
---|
472 | if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
|
---|
473 | then
|
---|
474 | echo " "$rawfile2" data("$sizezip") wue("$sizewue")"
|
---|
475 | wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
|
---|
476 | else
|
---|
477 | wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
|
---|
478 | fi
|
---|
479 | done
|
---|
480 |
|
---|
481 | result=$result"-"
|
---|
482 | #echo "Wue: ok: "$wueokcounter" diff: "$wuediffcounter
|
---|
483 | #echo "Arch: ok: "$archiveokcounter" diff: "$archivediffcounter
|
---|
484 | # raw files
|
---|
485 | echo "INFO "$dataokcounter" files are ok on data (raw)."
|
---|
486 | echo "WARN "$datadiffcounter" files have a different size on data (raw)."
|
---|
487 | if [ $dataokcounter -eq ${data[0]} ]
|
---|
488 | then
|
---|
489 | numok=`echo " $numok + 1 " | bc -l `
|
---|
490 | result=$result"0"
|
---|
491 | else
|
---|
492 | result=$result"1"
|
---|
493 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
494 | fi
|
---|
495 | # zipped files
|
---|
496 | # dl00
|
---|
497 | echo "INFO "$dl00okcounter" files are ok on dl00."
|
---|
498 | echo "WARN "$dl00diffcounter" files have a different size on dl00."
|
---|
499 | if [ $dl00okcounter -eq ${dl00[0]} ]
|
---|
500 | then
|
---|
501 | result=$result"0"
|
---|
502 | numok=`echo " $numok + 1 " | bc -l `
|
---|
503 | else
|
---|
504 | result=$result"1"
|
---|
505 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
506 | fi
|
---|
507 | # archive
|
---|
508 | echo "INFO "$archiveokcounter" files are ok in the archive."
|
---|
509 | echo "WARN "$archivediffcounter" files have a different size in the archive."
|
---|
510 | if [ $archiveokcounter -eq ${daq[0]} ]
|
---|
511 | then
|
---|
512 | result=$result"0"
|
---|
513 | numok=`echo " $numok + 1 " | bc -l `
|
---|
514 | else
|
---|
515 | result=$result"1"
|
---|
516 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
517 | fi
|
---|
518 | # wue
|
---|
519 | echo "INFO "$wueokcounter" files are ok in Wue."
|
---|
520 | echo "WARN "$wuediffcounter" files have a different size in Wue."
|
---|
521 | if [ $wueokcounter -eq ${wue[0]} ]
|
---|
522 | then
|
---|
523 | result=$result"0"
|
---|
524 | numok=`echo " $numok + 1 " | bc -l `
|
---|
525 | else
|
---|
526 | result=$result"1"
|
---|
527 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
528 | fi
|
---|
529 | fi
|
---|
530 |
|
---|
531 | # list #drs
|
---|
532 |
|
---|
533 | # print summary:
|
---|
534 | echo "INFO day ok: "$numdaysok
|
---|
535 | echo "INFO numok: "$numok
|
---|
536 | echo "INFO numpb: "$numpb
|
---|
537 | echo "result:"
|
---|
538 | echo "(#files-dudir-db-filesize)"
|
---|
539 | echo " ldaw-ldaw-ldaw-ldaw"
|
---|
540 | echo " "$result
|
---|
541 | #if [ $numpb -eq 0 ]
|
---|
542 | if [ $numpb -lt 4 ]
|
---|
543 | then
|
---|
544 | numdaysok=`echo " $numdaysok + 1 " | bc -l `
|
---|
545 | fi
|
---|
546 | done
|
---|
547 |
|
---|
548 | printprocesslog "INFO finished $0"
|
---|
549 |
|
---|