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