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