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 | numchecktransfer=`/usr/sbin/lsof $0 | grep -o -c $0`
|
---|
10 | if [ $numchecktransfer -gt 1 ]
|
---|
11 | then
|
---|
12 | printprocesslog "INFO "$0" already running -> exit. "
|
---|
13 | echo "INFO "$0" already running -> exit. "
|
---|
14 | finish
|
---|
15 | fi
|
---|
16 |
|
---|
17 | logfile2=$logpath"/transfer/CheckTransfer.log"
|
---|
18 | date > $logfile2 2>&1
|
---|
19 |
|
---|
20 | diskusage=( `ssh fact@161.72.93.131 "df -P /daq" | grep daq ` )
|
---|
21 | # check if more than X GB are left on /daq
|
---|
22 | if [ ${diskusage[3]} -lt 700000 ]
|
---|
23 | then
|
---|
24 | printprocesslog "DISK less than 700 GB left on /daq ("${diskusage[3]}")"
|
---|
25 | echo "WARN less than 700 GB left on /daq ("${diskusage[3]}")"
|
---|
26 | echo "WARN less than 700 GB left on /daq ("${diskusage[3]}")" >> $logfile2 2>&1
|
---|
27 | sendemail="yes"
|
---|
28 | fi
|
---|
29 |
|
---|
30 | diskusage2=( `df -P /scratch | grep scratch ` )
|
---|
31 | # check if more than X GB are left on /scratch
|
---|
32 | if [ ${diskusage2[3]} -lt 500000 ]
|
---|
33 | then
|
---|
34 | printprocesslog "DISK less than 500 GB left on /scratch ("${diskusage2[3]}")"
|
---|
35 | echo "WARN less than 500 GB left on /scratch "${diskusage2[3]}")"
|
---|
36 | echo "WARN less than 500 GB left on /scratch "${diskusage2[3]}")" >> $logfile2 2>&1
|
---|
37 | sendemail="yes"
|
---|
38 | fi
|
---|
39 |
|
---|
40 | # needed for transfer to phido
|
---|
41 | #source /home_nfs/isdc/fact_opr/myagent.sh
|
---|
42 |
|
---|
43 | # check first the disk in LP and on dl00
|
---|
44 | ssh fact@161.72.93.131 "df -h /*da*"
|
---|
45 | df -h /scratch
|
---|
46 | echo ""
|
---|
47 | echo "" >> $logfile2 2>&1
|
---|
48 |
|
---|
49 | # check next the DB to know if some transfer processes failed or crashed
|
---|
50 | function check_runs_in_db()
|
---|
51 | {
|
---|
52 | query="SELECT "$toquery" FROM "$1" "$where
|
---|
53 | #echo $query
|
---|
54 | runs=( `sendquery $query` )
|
---|
55 | if [ ${#runs[@]} -gt 0 ]
|
---|
56 | then
|
---|
57 | #for run in ${runs[@]}
|
---|
58 | #do
|
---|
59 | # echo $run
|
---|
60 | #done
|
---|
61 | sendemail="yes"
|
---|
62 | echo -e "\e[1;31m\x1b[5m ==>\e[00m "$1": "${runs[@]}"\e[1;31m\x1b[5m <==\e[00m "
|
---|
63 | echo "SELECT fNight, fRunId, fStartTime, fStopTime, fReturnCode FROM "$1" "$where";"
|
---|
64 | echo "UPDATE "$1" SET fStartTime=NULL, fStopTime=NULL, fAvailable=NULL, fReturnCode=NULL, fProcessingSiteKey=NULL "$where";"
|
---|
65 | echo -e " ==> "$1": "${runs[@]}" <== " >> $logfile2 2>&1
|
---|
66 | echo "---> Please check the DB and reset the processes if needed. " >> $logfile2 2>&1
|
---|
67 | echo "to check: SELECT fNight, fRunId, fStartTime, fStopTime, fReturnCode FROM "$1" "$where";" >> $logfile2 2>&1
|
---|
68 | echo "to reset: UPDATE "$1" SET fStartTime=NULL, fStopTime=NULL, fAvailable=NULL, fReturnCode=NULL, fProcessingSiteKey=NULL "$where";" >> $logfile2 2>&1
|
---|
69 | fi
|
---|
70 | }
|
---|
71 | # get information of runs where transfer had a problem
|
---|
72 | toquery="fNight, fRunID, fStartTime, fStopTime, fAvailable, fProcessingSiteKey, fReturnCode "
|
---|
73 | toquery="CONCAT(fNight, '_', fRunID, '(', fStartTime, '-', fStopTime, ':', fReturnCode, ')') "
|
---|
74 | toquery="CONCAT(fNight, '_', fRunID, ':', fReturnCode) "
|
---|
75 | toquery="IF (ISNULL(fReturnCode), CONCAT(fNight, '_', fRunID, 'crashed'), CONCAT(fNight, '_', fRunID, 'failed', fReturnCode)) "
|
---|
76 | where="WHERE NOT ISNULL(fReturnCode) OR (NOT ISNULL(fStartTime) AND ISNULL(fStopTime)) AND fStartTime < DATE_ADD(Now(), INTERVAL -5 HOUR) "
|
---|
77 | check_runs_in_db "RawFileRsyncedISDCStatus"
|
---|
78 | check_runs_in_db "RawFileAvailWueStatus"
|
---|
79 | # RawFileAvailISDC needs a different treatment
|
---|
80 | # as return code 0 means that file is in fails folder in archive
|
---|
81 | where="WHERE fReturnCode>0 OR (NOT ISNULL(fStartTime) AND ISNULL(fStopTime)) AND fStartTime < DATE_ADD(Now(), INTERVAL -1 HOUR) "
|
---|
82 | check_runs_in_db "RawFileAvailISDCStatus"
|
---|
83 |
|
---|
84 | # get nights from directory in LP
|
---|
85 | dates=( `ssh fact@161.72.93.131 "find /loc_data/zipraw -mindepth 3 -type d | sort | sed -e 's/\/loc_data\/zipraw\///g' "` )
|
---|
86 |
|
---|
87 | numdaysok=0
|
---|
88 | numdaysoklimit=10
|
---|
89 | sumdata=0
|
---|
90 | checklimit=5000
|
---|
91 | for date in ${dates[@]}
|
---|
92 | do
|
---|
93 | logfile=$logpath"/transfer/CheckTransfer_"`echo $date | sed -e 's/\//-/g'`".log"
|
---|
94 |
|
---|
95 | echo ""
|
---|
96 | echo "" >> $logfile2 2>&1
|
---|
97 | echo "Processing "$date" ..."
|
---|
98 | echo "Processing "$date" ..." >> $logfile2 2>&1
|
---|
99 |
|
---|
100 | # avoid that already checked days are checked again
|
---|
101 | if grep "EVERYTHING" $logfile >/dev/null 2>&1
|
---|
102 | then
|
---|
103 | echo " "$date" has been checked already and is fine. Please check logfile "$logfile
|
---|
104 | echo " "$date" has been checked already and is fine. Please check logfile "$logfile >> $logfile2 2>&1
|
---|
105 | sendemail="yes"
|
---|
106 | continue
|
---|
107 | fi
|
---|
108 | if [ "$certaindate" != "" ]
|
---|
109 | then
|
---|
110 | checkstring=`echo $certaindate | grep -E -o '^20[0-9][0-9]\/[01][0-9]\/[0-3][0-9]$'`
|
---|
111 | if [ "$checkstring" = "" ]
|
---|
112 | then
|
---|
113 | echo "Please give the variable certaindate in the correct format (YYYY/MM/DD)"
|
---|
114 | finish
|
---|
115 | fi
|
---|
116 | if [ "$certaindate" != "$date" ]
|
---|
117 | then
|
---|
118 | printprocesslog "INFO continue, as certaindate has been set to "$certaindate
|
---|
119 | echo " continue, as certaindate has been set to "$certaindate
|
---|
120 | continue
|
---|
121 | fi
|
---|
122 | fi
|
---|
123 |
|
---|
124 | # some counters
|
---|
125 | numdiff=0
|
---|
126 | numok=0
|
---|
127 | numpb=0
|
---|
128 |
|
---|
129 | # check always only $numdaysoklimit days
|
---|
130 | # and require at least $checklimit GB that have been checked
|
---|
131 | # remark: bc: expr1 < expr2: the result is 1 if expr1 is strictly less than expr2
|
---|
132 | if [ $numdaysok -ge $numdaysoklimit ] && [ $(echo " $sumdata > $checklimit " | bc -l) -eq 1 ]
|
---|
133 | then
|
---|
134 | printprocesslog "INFO more than "$numdaysoklimit" ok and more than "$checklimit" GB checked. "
|
---|
135 | continue
|
---|
136 | fi
|
---|
137 |
|
---|
138 | # get paths
|
---|
139 | date2=`echo $date | sed -e 's/\///g'`
|
---|
140 | # la palma
|
---|
141 | lprawpath="/newdaq/raw/"$date
|
---|
142 | lprawpath2="/daq/raw/"$date
|
---|
143 | # lprawpath2="/newdaq/raw/"$date #if daq is down
|
---|
144 | lpziprawpath="/loc_data/zipraw/"$date
|
---|
145 | qlapath="/daq/analysis/callisto/"$date
|
---|
146 | # qlapath="/newdaq/analysis/callisto/"$date #if daq is down
|
---|
147 | # isdc
|
---|
148 | localrawpath="/scratch/from_lapalma/raw/"$date
|
---|
149 | localrawpath3="/fact/raw/"$date
|
---|
150 | # localfailpath="/archive/fact/fails/raw/"$date
|
---|
151 | localfailpath="/gpfs/fact/fact-archive/fails/raw/"$date
|
---|
152 | # wuerzburg
|
---|
153 | wuerawpath="/fact/raw/"$date
|
---|
154 | # dortmund
|
---|
155 | #phidorawpath="/fhgfs/groups/app/fact-construction/raw/"$date
|
---|
156 |
|
---|
157 | # get disk usage and number of files for directory
|
---|
158 | # on newdaq files with more than 3 digits as run number are excluded
|
---|
159 | newdaq=( `ssh fact@161.72.93.131 "if [ -d $lprawpath ]; then ls $lprawpath/${date2}_[0-9][0-9][0-9][.]* | wc -l; du -s -b --apparent-size $lprawpath; else echo '-1 -1 -1'; fi"` )
|
---|
160 | 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"` )
|
---|
161 | if [ ${newdaq[0]} -eq -1 ] && [ ${daq[0]} -eq -1 ]
|
---|
162 | then
|
---|
163 | printprocesslog "INFO no data available on newdaq for "$date
|
---|
164 | echo "INFO no data available on newdaq for "$date >> $logfile 2>&1
|
---|
165 | continue
|
---|
166 | fi
|
---|
167 | zip=( `ssh fact@161.72.93.131 "if [ -d $lpziprawpath ]; then ls $lpziprawpath/* 2>/dev/null | wc -l; du -s -b --apparent-size $lpziprawpath; else echo '-1 -1 -1'; fi"` )
|
---|
168 | dl00=( `if [ -d $localrawpath ]; then ls $localrawpath/* | wc -l; du -s -b --apparent-size $localrawpath; else echo '-1 -1 -1'; fi` )
|
---|
169 | archive=( `if [ -d $localrawpath3 ]; then ls $localrawpath3/* 2>/dev/null | wc -l; du -L -s -b --apparent-size $localrawpath3; else echo '-1 -1 -1'; fi` )
|
---|
170 | fails=( `if [ -d $localfailpath ]; then ls $localfailpath/* | wc -l; du -L -s -b --apparent-size $localfailpath; else echo '-1 -1 -1'; fi` )
|
---|
171 | 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"` )
|
---|
172 | #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"` )
|
---|
173 | qla=( `ssh fact@161.72.93.131 "ls $qlapath/20*_C.root 2>/dev/null | wc -l"` )
|
---|
174 | query="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM RunInfo WHERE fNight="$date2
|
---|
175 | querystart="SELECT Sum(if(fHasDrsFile=1,2,1)) FROM "
|
---|
176 | queryjoin="LEFT JOIN RunInfo USING(fNight,fRunID) "
|
---|
177 | querywhere="WHERE fNight="$date2" AND NOT ISNULL(fStartTime) AND NOT ISNULL(fStopTime) AND ISNULL(fReturnCode)"
|
---|
178 | numruns=`sendquery`
|
---|
179 | if [ "$numruns" == "" ]
|
---|
180 | then
|
---|
181 | numruns=0
|
---|
182 | fi
|
---|
183 | query=$querystart"RawFileRsyncedISDCStatus "$queryjoin" "$querywhere
|
---|
184 | numrsynced=`sendquery`
|
---|
185 | if [ "$numrsynced" == "" ]
|
---|
186 | then
|
---|
187 | numrsynced=0
|
---|
188 | fi
|
---|
189 | query=$querystart"RawFileAvailISDCStatus "$queryjoin" "$querywhere
|
---|
190 | numisdc=`sendquery`
|
---|
191 | if [ "$numisdc" == "" ]
|
---|
192 | then
|
---|
193 | numisdc=0
|
---|
194 | fi
|
---|
195 | query=$querystart"RawFileAvailWueStatus "$queryjoin" "$querywhere
|
---|
196 | numwue=`sendquery`
|
---|
197 | if [ "$numwue" == "" ]
|
---|
198 | then
|
---|
199 | numwue=0
|
---|
200 | fi
|
---|
201 | #query=$querystart"RawFileAvailPhidoStatus "$queryjoin" "$querywhere
|
---|
202 | #numphido=`sendquery`
|
---|
203 | #if [ "$numphido" == "" ]
|
---|
204 | #then
|
---|
205 | # numphido=0
|
---|
206 | #fi
|
---|
207 |
|
---|
208 | # select number of data runs
|
---|
209 | query="SELECT COUNT(*) FROM RunInfo WHERE fNight="$date2
|
---|
210 | query=$query" AND fRunTypeKey=1"
|
---|
211 | numdatruns=`sendquery`
|
---|
212 |
|
---|
213 | printprocesslog "disk: "
|
---|
214 | printprocesslog " newdaq "${newdaq[@]}
|
---|
215 | printprocesslog " daq "${daq[@]}
|
---|
216 | printprocesslog " data "${zip[@]}
|
---|
217 | printprocesslog " dl00 "${dl00[@]}
|
---|
218 | printprocesslog " wue "${wue[@]}
|
---|
219 | printprocesslog " arch "${archive[@]}
|
---|
220 | printprocesslog " fail "${fails[@]}
|
---|
221 | #printprocesslog " phido "${phido[@]}
|
---|
222 | printprocesslog " qla "${qla[@]}
|
---|
223 | printprocesslog "db: "
|
---|
224 | printprocesslog " runinfo "$numruns
|
---|
225 | printprocesslog " rsynced "$numrsynced
|
---|
226 | printprocesslog " isdc "$numisdc
|
---|
227 | printprocesslog " wue "$numwue
|
---|
228 | #printprocesslog " phido "$numphido
|
---|
229 | printprocesslog " data "$numdatruns
|
---|
230 | echo "disk: " >> $logfile 2>&1
|
---|
231 | echo " newdaq "${newdaq[@]} >> $logfile 2>&1
|
---|
232 | echo " daq "${daq[@]} >> $logfile 2>&1
|
---|
233 | echo " data "${zip[@]} >> $logfile 2>&1
|
---|
234 | echo " dl00 "${dl00[@]} >> $logfile 2>&1
|
---|
235 | echo " wue "${wue[@]} >> $logfile 2>&1
|
---|
236 | echo " arch "${archive[@]} >> $logfile 2>&1
|
---|
237 | echo " fail "${fails[@]} >> $logfile 2>&1
|
---|
238 | #echo " phido "${phido[@]} >> $logfile 2>&1
|
---|
239 | echo " qla "${qla[@]} >> $logfile 2>&1
|
---|
240 | echo "db: " >> $logfile 2>&1
|
---|
241 | echo " runinfo "$numruns >> $logfile 2>&1
|
---|
242 | echo " rsynced "$numrsynced >> $logfile 2>&1
|
---|
243 | echo " isdc "$numisdc >> $logfile 2>&1
|
---|
244 | echo " wue "$numwue >> $logfile 2>&1
|
---|
245 | #echo " phido "$numphido >> $logfile 2>&1
|
---|
246 | echo " datruns "$numdatruns >> $logfile 2>&1
|
---|
247 |
|
---|
248 | if ! [ $numdatruns -eq $qla ]
|
---|
249 | then
|
---|
250 | printprocesslog "WARN not all data runs are processed yet by the QLA for "$date"."
|
---|
251 | echo "WARN not all data runs are processed yet by the QLA for "$date >> $logfile 2>&1
|
---|
252 | result1="1-"
|
---|
253 | else
|
---|
254 | result1="0-"
|
---|
255 | fi
|
---|
256 | # check if file are available in the different places
|
---|
257 | if [ ${dl00[0]} -eq -1 ] && [ $date2 -lt 20120308 ]
|
---|
258 | then
|
---|
259 | printprocesslog "INFO data not available on /scratch on dl00 for "$date
|
---|
260 | echo "INFO data not available on /scratch on dl00 for "$date >> $logfile 2>&1
|
---|
261 | fi
|
---|
262 | if [ ${archive[0]} -eq -1 ]
|
---|
263 | then
|
---|
264 | printprocesslog "INFO data not in archive for "$date
|
---|
265 | echo "INFO data not in archive for "$date >> $logfile 2>&1
|
---|
266 | fi
|
---|
267 |
|
---|
268 | # check if number of files agree in the different places
|
---|
269 | # lp
|
---|
270 | if ! [ ${daq[0]} -eq -1 ] && ! [ ${daq[0]} -eq ${newdaq[0]} ]
|
---|
271 | then
|
---|
272 | printprocesslog "WARN number of files on daq (" ${daq[0]}") does not agree with number of files on newdaq (" ${newdaq[0]}") for "$date
|
---|
273 | echo "WARN number of files on daq (" ${daq[0]}") does not agree with number of files on newdaq (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
---|
274 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
275 | result1=$result1"1"
|
---|
276 | else
|
---|
277 | numok=`echo " $numok + 1 " | bc -l `
|
---|
278 | result1=$result1"0"
|
---|
279 | fi
|
---|
280 | # dl00
|
---|
281 | #if ! [ ${dl00[0]} -eq -1 ] && ! [ ${dl00[0]} -eq ${newdaq[0]} ]
|
---|
282 | if ! [ ${dl00[0]} -eq ${newdaq[0]} ]
|
---|
283 | then
|
---|
284 | printprocesslog "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
---|
285 | echo "WARN number of files on dl00 (" ${dl00[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
---|
286 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
287 | result1=$result1"1"
|
---|
288 | else
|
---|
289 | numok=`echo " $numok + 1 " | bc -l `
|
---|
290 | result1=$result1"0"
|
---|
291 | fi
|
---|
292 | # archive
|
---|
293 | if ! [ ${archive[0]} -eq -1 ] && ! [ ${archive[0]} -eq ${newdaq[0]} ]
|
---|
294 | then
|
---|
295 | printprocesslog "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
---|
296 | echo "WARN number of files in archive (" ${archive[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
---|
297 | #check /archive/rev_1/failed
|
---|
298 | if ! [ ${fails[0]} -eq -1 ]
|
---|
299 | then
|
---|
300 | sum=`echo " ${fails[0]} + ${archive[0]} " | bc -l `
|
---|
301 | if ! [ $sum -eq ${newdaq[0]} ]
|
---|
302 | then
|
---|
303 | printprocesslog "ERROR number of files in whole archive ("$sum") is different from number of files in La Palma ("${newdaq[0]}")."
|
---|
304 | echo "ERROR number of files in whole archive ("$sum") is different from number of files in La Palma ("${newdaq[0]}")." >> $logfile 2>&1
|
---|
305 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
306 | result1=$result1"1"
|
---|
307 | else
|
---|
308 | numok=`echo " $numok + 1 " | bc -l `
|
---|
309 | result1=$result1"0"
|
---|
310 | fi
|
---|
311 | else
|
---|
312 | result1=$result1"1"
|
---|
313 | fi
|
---|
314 | else
|
---|
315 | if [ ${archive[0]} -eq -1 ]
|
---|
316 | then
|
---|
317 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
318 | result1=$result1"1"
|
---|
319 | else
|
---|
320 | numok=`echo " $numok + 1 " | bc -l `
|
---|
321 | result1=$result1"0"
|
---|
322 | fi
|
---|
323 | fi
|
---|
324 | # wue
|
---|
325 | #if ! [ ${wue[0]} -eq -1 ] && ! [ ${wue[0]} -eq ${newdaq[0]} ]
|
---|
326 | if ! [ ${wue[0]} -eq ${newdaq[0]} ]
|
---|
327 | then
|
---|
328 | printprocesslog "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
---|
329 | echo "WARN number of files in Wue (" ${wue[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
---|
330 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
331 | result1=$result1"1"
|
---|
332 | else
|
---|
333 | numok=`echo " $numok + 1 " | bc -l `
|
---|
334 | result1=$result1"0"
|
---|
335 | fi
|
---|
336 | ## phido
|
---|
337 | #if ! [ ${phido[0]} -eq -1 ] && ! [ ${phido[0]} -eq ${newdaq[0]} ]
|
---|
338 | #then
|
---|
339 | # printprocesslog "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date
|
---|
340 | # echo "WARN number of files on Phido (" ${phido[0]}") does not agree with number of files in LP (" ${newdaq[0]}") for "$date >> $logfile 2>&1
|
---|
341 | # numpb=`echo " $numpb + 1 " | bc -l `
|
---|
342 | # result1=$result1"1"
|
---|
343 | #else
|
---|
344 | # numok=`echo " $numok + 1 " | bc -l `
|
---|
345 | # result1=$result1"0"
|
---|
346 | #fi
|
---|
347 |
|
---|
348 | short2=
|
---|
349 | if [ "$result1" != "0-0000" ] && [ "$short" != "no" ]
|
---|
350 | then
|
---|
351 | short2="yes"
|
---|
352 | fi
|
---|
353 |
|
---|
354 | if [ "$short2" = "yes" ]
|
---|
355 | then
|
---|
356 | printprocesslog "number of files does not yet agree in all sites ("$result1") -> do no further checking."
|
---|
357 | echo "" >> $logfile 2>&1
|
---|
358 | echo "number of files does not yet agree in all sites ("$result1") -> do no further checking." >> $logfile 2>&1
|
---|
359 | echo "" >> $logfile 2>&1
|
---|
360 | # print to console
|
---|
361 | echo "SUMMARY for "$date
|
---|
362 | echo "-----------------------"
|
---|
363 | echo " number of files does not yet agree in all sites: "${newdaq[0]}" (newdaq) "${daq[0]}" (daq) "${zip[0]}" (data) "${dl00[0]}" (dl) "${wue[0]}" (wue) "${archive[0]}" (arch) "${fails[0]}" (fails) "${qla[@]}" (qla) "$numdatruns" (datruns) "
|
---|
364 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
|
---|
365 | # print to single logfile
|
---|
366 | echo "SUMMARY for "$date >> $logfile 2>&1
|
---|
367 | echo "-----------------------" >> $logfile 2>&1
|
---|
368 | echo " number of files does not yet agree in all sites: "${newdaq[0]}" (newdaq) "${daq[0]}" (daq) "${zip[0]}" (data) "${dl00[0]}" (dl) "${wue[0]}" (wue) "${archive[0]}" (arch) "${fails[0]}" (fails) "${qla[@]}" (qla) "$numdatruns" (datruns) " >> $logfile 2>&1
|
---|
369 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
|
---|
370 | # print to global logfile
|
---|
371 | echo "SUMMARY for "$date >> $logfile2 2>&1
|
---|
372 | echo "-----------------------" >> $logfile2 2>&1
|
---|
373 | echo " number of files does not yet agree in all sites: "${newdaq[0]}" (newdaq) "${daq[0]}" (daq) "${zip[0]}" (data) "${dl00[0]}" (dl) "${wue[0]}" (wue) "${archive[0]}" (arch) "${fails[0]}" (fails) "${qla[@]}" (qla) "$numdatruns" (datruns) " >> $logfile2 2>&1
|
---|
374 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
|
---|
375 | continue
|
---|
376 | fi
|
---|
377 |
|
---|
378 | # check du for raw files
|
---|
379 | # la palma
|
---|
380 | if ! [ ${newdaq[1]} -eq ${daq[1]} ]
|
---|
381 | then
|
---|
382 | printprocesslog "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and daq ("${daq[1]}") for "$date
|
---|
383 | echo "WARN size of data doesn't agree on newdaq ("${newdaq[1]}") and daq ("${daq[1]}") for "$date >> $logfile 2>&1
|
---|
384 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
385 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
386 | result2="1"
|
---|
387 | else
|
---|
388 | numok=`echo " $numok + 1 " | bc -l `
|
---|
389 | result2="0"
|
---|
390 | fi
|
---|
391 | # check du for zipped raw files
|
---|
392 | # dl00
|
---|
393 | if ! [ ${zip[1]} -eq ${dl00[1]} ] && [ $date2 -gt 20120307 ]
|
---|
394 | then
|
---|
395 | printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date
|
---|
396 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and dl00 ("${dl00[1]}") for "$date >> $logfile 2>&1
|
---|
397 | if ! [ ${dl00[1]} -eq -1 ]
|
---|
398 | then
|
---|
399 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
400 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
401 | result2=$result2"1"
|
---|
402 | else
|
---|
403 | numok=`echo " $numok + 1 " | bc -l `
|
---|
404 | result2=$result2"0"
|
---|
405 | fi
|
---|
406 | else
|
---|
407 | numok=`echo " $numok + 1 " | bc -l `
|
---|
408 | result2=$result2"0"
|
---|
409 | fi
|
---|
410 | # archive
|
---|
411 | if ! [ ${zip[1]} -eq ${archive[1]} ]
|
---|
412 | then
|
---|
413 | printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date
|
---|
414 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and in archive ("${archive[1]}") for "$date >> $logfile 2>&1
|
---|
415 | if ! [ ${archive[1]} -eq -1 ]
|
---|
416 | then
|
---|
417 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
418 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
419 | result2=$result2"1"
|
---|
420 | else
|
---|
421 | numok=`echo " $numok + 1 " | bc -l `
|
---|
422 | result2=$result2"0"
|
---|
423 | fi
|
---|
424 | else
|
---|
425 | numok=`echo " $numok + 1 " | bc -l `
|
---|
426 | result2=$result2"0"
|
---|
427 | fi
|
---|
428 | # wue
|
---|
429 | if ! [ ${zip[1]} -eq ${wue[1]} ]
|
---|
430 | then
|
---|
431 | printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date
|
---|
432 | echo "WARN size of data doesn't agree on data ("${zip[1]}") and in Wue ("${wue[1]}") for "$date >> $logfile 2>&1
|
---|
433 | if ! [ ${wue[1]} -eq -1 ]
|
---|
434 | then
|
---|
435 | numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
436 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
437 | result2=$result2"1"
|
---|
438 | else
|
---|
439 | numok=`echo " $numok + 1 " | bc -l `
|
---|
440 | result2=$result2"0"
|
---|
441 | fi
|
---|
442 | else
|
---|
443 | numok=`echo " $numok + 1 " | bc -l `
|
---|
444 | result2=$result2"0"
|
---|
445 | fi
|
---|
446 | ## phido
|
---|
447 | #if ! [ ${zip[1]} -eq ${phido[1]} ]
|
---|
448 | #then
|
---|
449 | # printprocesslog "WARN size of data doesn't agree on data ("${zip[1]}") and on Phido ("${phido[1]}") for "$date
|
---|
450 | # echo "WARN size of data doesn't agree on data ("${zip[1]}") and on Phido ("${phido[1]}") for "$date >> $logfile 2>&1
|
---|
451 | # if ! [ ${phido[1]} -eq -1 ]
|
---|
452 | # then
|
---|
453 | # numdiff=`echo " $numdiff + 1 " | bc -l `
|
---|
454 | # numpb=`echo " $numpb + 1 " | bc -l `
|
---|
455 | # result2=$result2"1"
|
---|
456 | # else
|
---|
457 | # numok=`echo " $numok + 1 " | bc -l `
|
---|
458 | # result2=$result2"0"
|
---|
459 | # fi
|
---|
460 | #else
|
---|
461 | # numok=`echo " $numok + 1 " | bc -l `
|
---|
462 | # result2=$result2"0"
|
---|
463 | #fi
|
---|
464 | #result=$result"-"
|
---|
465 |
|
---|
466 | # check DB (only starting from 8.3.2012) (if-clause to be removed later)
|
---|
467 | if [ $date2 -gt 20120307 ]
|
---|
468 | then
|
---|
469 | # lp
|
---|
470 | if ! [ $numruns -eq ${newdaq[0]} ]
|
---|
471 | then
|
---|
472 | printprocesslog "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns")"
|
---|
473 | echo "WARN number of runs on newdaq ("${newdaq[0]}") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
---|
474 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
475 | result3="1"
|
---|
476 | else
|
---|
477 | numok=`echo " $numok + 1 " | bc -l `
|
---|
478 | result3="0"
|
---|
479 | fi
|
---|
480 | # dl00
|
---|
481 | if ! [ $numruns -eq $numrsynced ]
|
---|
482 | then
|
---|
483 | printprocesslog "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")"
|
---|
484 | echo "WARN number of rsynced runs ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
---|
485 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
486 | result3=$result3"1"
|
---|
487 | else
|
---|
488 | numok=`echo " $numok + 1 " | bc -l `
|
---|
489 | result3=$result3"0"
|
---|
490 | fi
|
---|
491 | # archive
|
---|
492 | if ! [ $numruns -eq $numisdc ]
|
---|
493 | then
|
---|
494 | printprocesslog "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")"
|
---|
495 | echo "WARN number of ingested files in archive ("$numisdc") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
---|
496 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
497 | result3=$result3"1"
|
---|
498 | else
|
---|
499 | numok=`echo " $numok + 1 " | bc -l `
|
---|
500 | result3=$result3"0"
|
---|
501 | fi
|
---|
502 | # wue
|
---|
503 | if ! [ $numruns -eq $numwue ]
|
---|
504 | then
|
---|
505 | printprocesslog "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")"
|
---|
506 | echo "WARN number of backuped in Wue ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
---|
507 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
508 | result3=$result3"1"
|
---|
509 | else
|
---|
510 | numok=`echo " $numok + 1 " | bc -l `
|
---|
511 | result3=$result3"0"
|
---|
512 | fi
|
---|
513 | ## phido
|
---|
514 | #if ! [ $numruns -eq $numphido ]
|
---|
515 | #then
|
---|
516 | # printprocesslog "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")"
|
---|
517 | # echo "WARN number of backuped on Phido ("$numrsynced") not equal to number of runs ("$numruns")" >> $logfile 2>&1
|
---|
518 | # numpb=`echo " $numpb + 1 " | bc -l `
|
---|
519 | # result3=$result3"1"
|
---|
520 | #else
|
---|
521 | # numok=`echo " $numok + 1 " | bc -l `
|
---|
522 | # result3=$result3"0"
|
---|
523 | #fi
|
---|
524 | fi
|
---|
525 |
|
---|
526 | #numdiff=0 # add for debugging so that single file sizes are not checked
|
---|
527 | printprocesslog "numdiff: "$numdiff
|
---|
528 | printprocesslog "INFO numok: "$numok
|
---|
529 | printprocesslog "INFO numpb: "$numpb
|
---|
530 | echo "numdiff: "$numdiff >> $logfile 2>&1
|
---|
531 | echo "INFO numok: "$numok >> $logfile 2>&1
|
---|
532 | echo "INFO numpb: "$numpb >> $logfile 2>&1
|
---|
533 | #if [ $numdiff -gt 0 ]
|
---|
534 | if [ $numdiff -ge 0 ]
|
---|
535 | then
|
---|
536 | query="SELECT fRunID FROM RunInfo WHERE fNight="$date2
|
---|
537 | runs=( `sendquery` )
|
---|
538 | archivediffcounter=0
|
---|
539 | archiveokcounter=0
|
---|
540 | wuediffcounter=0
|
---|
541 | wueokcounter=0
|
---|
542 | #phidodiffcounter=0
|
---|
543 | #phidookcounter=0
|
---|
544 | dl00diffcounter=0
|
---|
545 | dl00okcounter=0
|
---|
546 | daqdiffcounter=0
|
---|
547 | daqokcounter=0
|
---|
548 | printprocesslog "INFO found "${#runs[@]}" rawfiles in DB."
|
---|
549 | echo "INFO found "${#runs[@]}" rawfiles in DB." >> $logfile 2>&1
|
---|
550 | for run in ${runs[@]}
|
---|
551 | do
|
---|
552 | rawfile=$date2"_"`printf %03d $run`".fits"
|
---|
553 | #rawfile2=$rawfile".gz"
|
---|
554 | rawfile2=$rawfile".*z"
|
---|
555 | printprocesslog "INFO checking "$rawfile
|
---|
556 |
|
---|
557 | # get file sizes for run
|
---|
558 | #sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
559 | sizenewdaq=( `ssh fact@161.72.93.131 "ls -lH ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
560 | sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
561 | sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
562 | if ! [ ${dl00[1]} -eq -1 ]
|
---|
563 | then
|
---|
564 | sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
565 | fi
|
---|
566 | if ! [ ${archive[1]} -eq -1 ]
|
---|
567 | then
|
---|
568 | sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
569 | fi
|
---|
570 | if ! [ ${fails[1]} -eq -1 ]
|
---|
571 | then
|
---|
572 | sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
573 | fi
|
---|
574 | if ! [ ${wue[1]} -eq -1 ]
|
---|
575 | then
|
---|
576 | sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
577 | fi
|
---|
578 | #if ! [ ${phido[1]} -eq -1 ]
|
---|
579 | #then
|
---|
580 | # 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 }'"` )
|
---|
581 | #fi
|
---|
582 |
|
---|
583 | # check file sizes for run
|
---|
584 | # lp
|
---|
585 | if ! [ "$sizenewdaq" = "$sizedaq" ]
|
---|
586 | then
|
---|
587 | printprocesslog "WARN "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
|
---|
588 | echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")" >> $logfile 2>&1
|
---|
589 | daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
|
---|
590 | else
|
---|
591 | daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
|
---|
592 | fi
|
---|
593 | # dl00
|
---|
594 | if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
|
---|
595 | then
|
---|
596 | printprocesslog "WARN "$rawfile2" data("$sizezip") dl00("$sizedl00")"
|
---|
597 | echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
|
---|
598 | dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
|
---|
599 | else
|
---|
600 | dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
|
---|
601 | fi
|
---|
602 | # archive
|
---|
603 | #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
|
---|
604 | #if [ ${archive[1]} -ne -1 ] && [ "$sizezip" != "$sizearchive" -o "$sizezip" != "$sizefails" ]
|
---|
605 | if [ ${archive[1]} -ne -1 -a "$sizezip" != "$sizearchive" -a "$sizezip" != "$sizefails" ]
|
---|
606 | then
|
---|
607 | printprocesslog "WARN "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
---|
608 | echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
|
---|
609 | #echo " "$sizezip"-"$sizearchive"-"${archive[1]}"-"$sizezip"-"$sizefails"-"${fails[1]}
|
---|
610 | archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
|
---|
611 | else
|
---|
612 | archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
---|
613 | fi
|
---|
614 | # wue
|
---|
615 | if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
|
---|
616 | then
|
---|
617 | printprocesslog "WARN "$rawfile2" data("$sizezip") wue("$sizewue")"
|
---|
618 | echo " "$rawfile2" data("$sizezip") wue("$sizewue")" >> $logfile 2>&1
|
---|
619 | wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
|
---|
620 | else
|
---|
621 | wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
|
---|
622 | fi
|
---|
623 | ## phido
|
---|
624 | #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
|
---|
625 | #then
|
---|
626 | # printprocesslog " "$rawfile2" data("$sizezip") phido("$sizephido")"
|
---|
627 | # echo " "$rawfile2" data("$sizezip") phido("$sizephido")" >> $logfile 2>&1
|
---|
628 | # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
|
---|
629 | #else
|
---|
630 | # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
|
---|
631 | #fi
|
---|
632 | done
|
---|
633 | query="SELECT fRunID FROM RunInfo WHERE fNight="$date2" AND fHasDrsFile=1"
|
---|
634 | drsruns=( `sendquery` )
|
---|
635 | printprocesslog "INFO found "${#drsruns[@]}" drsfiles in DB."
|
---|
636 | echo "INFO found "${#drsruns[@]}" drsfiles in DB." >> $logfile 2>&1
|
---|
637 | for drsrun in ${drsruns[@]}
|
---|
638 | do
|
---|
639 | rawfile=$date2"_"`printf %03d $drsrun`".drs.fits"
|
---|
640 | #rawfile2=$rawfile".gz"
|
---|
641 | rawfile2=$rawfile".*z"
|
---|
642 | # get file sizes for run
|
---|
643 | #sizenewdaq=( `ssh fact@161.72.93.131 "ls -l ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
644 | sizenewdaq=( `ssh fact@161.72.93.131 "ls -lH ${lprawpath}/${rawfile} 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
645 | sizedaq=( `ssh fact@161.72.93.131 "ls -l $lprawpath2/$rawfile 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
646 | sizezip=( `ssh fact@161.72.93.131 "ls -l $lpziprawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
647 | if ! [ ${dl00[1]} -eq -1 ]
|
---|
648 | then
|
---|
649 | sizedl00=( `ls -l $localrawpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
650 | fi
|
---|
651 | if ! [ ${archive[1]} -eq -1 ]
|
---|
652 | then
|
---|
653 | sizearchive=( `ls -lH $localrawpath3/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
654 | fi
|
---|
655 | if ! [ ${fails[1]} -eq -1 ]
|
---|
656 | then
|
---|
657 | sizefails=( `ls -lH $localfailpath/$rawfile2 2>/dev/null | awk '{ print \$5 }'` )
|
---|
658 | fi
|
---|
659 | if ! [ ${wue[1]} -eq -1 ]
|
---|
660 | then
|
---|
661 | sizewue=( `ssh operator@coma.astro.uni-wuerzburg.de "ls -l $wuerawpath/$rawfile2 2>/dev/null | awk '{ print \\\$5 }'"` )
|
---|
662 | fi
|
---|
663 | #if ! [ ${phido[1]} -eq -1 ]
|
---|
664 | #then
|
---|
665 | # 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 }'"` )
|
---|
666 | #fi
|
---|
667 |
|
---|
668 | # check file sizes for run
|
---|
669 | # lp
|
---|
670 | if ! [ "$sizenewdaq" = "$sizedaq" ]
|
---|
671 | then
|
---|
672 | printprocesslog "WARN "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")"
|
---|
673 | echo " "$rawfile" newdaq("$sizenewdaq") daq("$sizedaq")" >> $logfile 2>&1
|
---|
674 | daqdiffcounter=`echo " $daqdiffcounter + 1 " | bc -l `
|
---|
675 | else
|
---|
676 | daqokcounter=`echo " $daqokcounter + 1 " | bc -l `
|
---|
677 | fi
|
---|
678 | # dl00
|
---|
679 | if ! [ "$sizezip" = "$sizedl00" ] && ! [ ${dl00[1]} -eq -1 ]
|
---|
680 | then
|
---|
681 | printprocesslog "WARN "$rawfile2" data("$sizezip") dl00("$sizedl00")"
|
---|
682 | echo " "$rawfile2" data("$sizezip") dl00("$sizedl00")" >> $logfile 2>&1
|
---|
683 | dl00diffcounter=`echo " $dl00diffcounter + 1 " | bc -l `
|
---|
684 | else
|
---|
685 | dl00okcounter=`echo " $dl00okcounter + 1 " | bc -l `
|
---|
686 | fi
|
---|
687 | #if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 ]
|
---|
688 | if [ "$sizezip" != "$sizearchive" -a ${archive[1]} -ne -1 -a "$sizearchive" != "" ] || [ "$sizezip" != "$sizefails" -a ${fails[1]} -ne -1 -a "$sizefails" != "" ]
|
---|
689 | then
|
---|
690 | printprocesslog "WARN "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")"
|
---|
691 | echo " "$rawfile2" data("$sizezip") archive("$sizearchive"/"$sizefails")" >> $logfile 2>&1
|
---|
692 | archivediffcounter=`echo " $archivediffcounter + 1 " | bc -l `
|
---|
693 | else
|
---|
694 | archiveokcounter=`echo " $archiveokcounter + 1 " | bc -l `
|
---|
695 | fi
|
---|
696 | # wue
|
---|
697 | if ! [ "$sizezip" = "$sizewue" ] && ! [ ${wue[1]} -eq -1 ]
|
---|
698 | then
|
---|
699 | printprocesslog "WARN "$rawfile2" data("$sizezip") wue("$sizewue")"
|
---|
700 | echo " "$rawfile2" data("$sizezip") wue("$sizewue")" >> $logfile 2>&1
|
---|
701 | wuediffcounter=`echo " $wuediffcounter + 1 " | bc -l `
|
---|
702 | else
|
---|
703 | wueokcounter=`echo " $wueokcounter + 1 " | bc -l `
|
---|
704 | fi
|
---|
705 | ## phido
|
---|
706 | #if ! [ "$sizezip" = "$sizephido" ] && ! [ ${phido[1]} -eq -1 ]
|
---|
707 | #then
|
---|
708 | # printprocesslog "WARN "$rawfile2" data("$sizezip") phido("$sizephido")"
|
---|
709 | # echo " "$rawfile2" data("$sizezip") phido("$sizephido")" >> $logfile 2>&1
|
---|
710 | # phidodiffcounter=`echo " $phidodiffcounter + 1 " | bc -l `
|
---|
711 | #else
|
---|
712 | # phidookcounter=`echo " $phidookcounter + 1 " | bc -l `
|
---|
713 | #fi
|
---|
714 | done
|
---|
715 |
|
---|
716 | #result=$result"-"
|
---|
717 | # raw files
|
---|
718 | if [ $daqokcounter -eq ${daq[0]} ]
|
---|
719 | then
|
---|
720 | numok=`echo " $numok + 1 " | bc -l `
|
---|
721 | result4="0"
|
---|
722 | else
|
---|
723 | result4="1"
|
---|
724 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
725 | fi
|
---|
726 | # zipped files
|
---|
727 | # dl00
|
---|
728 | if [ $dl00okcounter -eq ${dl00[0]} ]
|
---|
729 | then
|
---|
730 | result4=$result4"0"
|
---|
731 | numok=`echo " $numok + 1 " | bc -l `
|
---|
732 | else
|
---|
733 | result4=$result4"1"
|
---|
734 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
735 | fi
|
---|
736 | # archive
|
---|
737 | # daq had been used, because archive[0] doesn't include fails[0]
|
---|
738 | #if [ $archiveokcounter -eq ${newdaq[0]} ]
|
---|
739 | # archive[0] had been used, because newdaq[0] might be empty
|
---|
740 | # in case the data was taken on data
|
---|
741 | #if [ $archiveokcounter -eq ${archive[0]} ]
|
---|
742 | # compare with daq[0] as there should be always data on data
|
---|
743 | if [ $archiveokcounter -eq ${daq[0]} ]
|
---|
744 | then
|
---|
745 | result4=$result4"0"
|
---|
746 | numok=`echo " $numok + 1 " | bc -l `
|
---|
747 | else
|
---|
748 | result4=$result4"1"
|
---|
749 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
750 | fi
|
---|
751 | # wue
|
---|
752 | if [ $wueokcounter -eq ${wue[0]} ]
|
---|
753 | then
|
---|
754 | result4=$result4"0"
|
---|
755 | numok=`echo " $numok + 1 " | bc -l `
|
---|
756 | else
|
---|
757 | result4=$result4"1"
|
---|
758 | numpb=`echo " $numpb + 1 " | bc -l `
|
---|
759 | fi
|
---|
760 | ## phido
|
---|
761 | #if [ $phidookcounter -eq ${phido[0]} ]
|
---|
762 | #then
|
---|
763 | # result4=$result4"0"
|
---|
764 | # numok=`echo " $numok + 1 " | bc -l `
|
---|
765 | #else
|
---|
766 | # result4=$result4"1"
|
---|
767 | # numpb=`echo " $numpb + 1 " | bc -l `
|
---|
768 | #fi
|
---|
769 | printprocesslog "INFO "$daqokcounter" files are ok on daq (raw)."
|
---|
770 | printprocesslog "INFO "$dl00okcounter" files are ok on dl00."
|
---|
771 | printprocesslog "INFO "$wueokcounter" files are ok in Wue."
|
---|
772 | printprocesslog "INFO "$archiveokcounter" files are ok in the archive."
|
---|
773 | #printprocesslog "INFO "$phidookcounter" files are ok on Phido."
|
---|
774 | echo "INFO "$daqokcounter" files are ok on daq (raw)." >> $logfile 2>&1
|
---|
775 | echo "INFO "$dl00okcounter" files are ok on dl00." >> $logfile 2>&1
|
---|
776 | echo "INFO "$wueokcounter" files are ok in Wue." >> $logfile 2>&1
|
---|
777 | echo "INFO "$archiveokcounter" files are ok in the archive." >> $logfile 2>&1
|
---|
778 | #echo "INFO "$phidookcounter" files are ok on Phido." >> $logfile 2>&1
|
---|
779 | if [ $daqdiffcounter -gt 0 ]
|
---|
780 | then
|
---|
781 | printprocesslog "WARN "$daqdiffcounter" files have a different size on daq (raw)."
|
---|
782 | echo "WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
|
---|
783 | else
|
---|
784 | printprocesslog "INFO "$daqdiffcounter" files have a different size on daq (raw)."
|
---|
785 | echo "INFO "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
|
---|
786 | fi
|
---|
787 | if [ $dl00diffcounter -gt 0 ]
|
---|
788 | then
|
---|
789 | printprocesslog "WARN "$dl00diffcounter" files have a different size on dl00."
|
---|
790 | echo "WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
|
---|
791 | else
|
---|
792 | printprocesslog "INFO "$dl00diffcounter" files have a different size on dl00."
|
---|
793 | echo "INFO "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
|
---|
794 | fi
|
---|
795 | if [ $wuediffcounter -gt 0 ]
|
---|
796 | then
|
---|
797 | printprocesslog "WARN "$wuediffcounter" files have a different size in Wue."
|
---|
798 | echo "WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
|
---|
799 | else
|
---|
800 | printprocesslog "INFO "$wuediffcounter" files have a different size in Wue."
|
---|
801 | echo "INFO "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
|
---|
802 | fi
|
---|
803 | if [ $archivediffcounter -gt 0 ]
|
---|
804 | then
|
---|
805 | printprocesslog "WARN "$archivediffcounter" files have a different size in the archive."
|
---|
806 | echo "WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
|
---|
807 | else
|
---|
808 | printprocesslog "INFO "$archivediffcounter" files have a different size in the archive."
|
---|
809 | echo "INFO "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
|
---|
810 | fi
|
---|
811 | #printprocesslog "WARN "$phidodiffcounter" files have a different size on Phido."
|
---|
812 | #echo "WARN "$phidodiffcounter" files have a different size on Phido." >> $logfile 2>&1
|
---|
813 | fi
|
---|
814 |
|
---|
815 | # print summary:
|
---|
816 | printprocesslog "INFO day ok: "$numdaysok
|
---|
817 | printprocesslog "INFO numok: "$numok
|
---|
818 | printprocesslog "INFO numpb: "$numpb
|
---|
819 | printprocesslog "result:"
|
---|
820 | printprocesslog "(qla-#files-dudir-db-filesize)"
|
---|
821 | #printprocesslog " ldawp-ldawp-ldawp-ldawp"
|
---|
822 | printprocesslog " q-ldaw-ldaw-ldaw-ldaw"
|
---|
823 | printprocesslog " "$result1"-"$result2"-"$result3"-"$result4
|
---|
824 | echo "INFO day ok: "$numdaysok >> $logfile 2>&1
|
---|
825 | echo "INFO numok: "$numok >> $logfile 2>&1
|
---|
826 | echo "INFO numpb: "$numpb >> $logfile 2>&1
|
---|
827 | echo "result:" >> $logfile 2>&1
|
---|
828 | echo "(qla-#files-dudir-db-filesize)" >> $logfile 2>&1
|
---|
829 | #echo " ldawp-ldawp-ldawp-ldawp" >> $logfile 2>&1
|
---|
830 | echo " q-ldaw-ldaw-ldaw-ldaw" >> $logfile 2>&1
|
---|
831 | echo " "$result1"-"$result2"-"$result3"-"$result4 >> $logfile 2>&1
|
---|
832 | sumdatanew=`echo " ( ${daq[1]} + ${zip[1]} ) / 1024 / 1024 / 1024 " | bc -l | cut -d. -f1`
|
---|
833 | sumdata=`echo " $sumdata + $sumdatanew " | bc -l | cut -d. -f1`
|
---|
834 | printprocesslog "checked alread "$sumdata" GB. "$sumdatanew" "${daq[1]}" "${zip[1]}
|
---|
835 | if [ $numpb -lt 4 ]
|
---|
836 | then
|
---|
837 | numdaysok=`echo " $numdaysok + 1 " | bc -l `
|
---|
838 | fi
|
---|
839 |
|
---|
840 | echo "SUMMARY for "$date
|
---|
841 | echo "-----------------------"
|
---|
842 | echo "SUMMARY for "$date >> $logfile 2>&1
|
---|
843 | echo "-----------------------" >> $logfile 2>&1
|
---|
844 | echo "SUMMARY for "$date >> $logfile2 2>&1
|
---|
845 | echo "-----------------------" >> $logfile2 2>&1
|
---|
846 | #echo "res1:"$result1
|
---|
847 | #echo "res3:"$result3
|
---|
848 | #echo "res4:"$result4
|
---|
849 | #echo "arch:"${archive[0]}
|
---|
850 | #echo "isdc:"$numisdc
|
---|
851 | if [ "$result1" = "0-0000" ] && [ "$result3" = "0000" ] && [ "$result4" = "0000" ]
|
---|
852 | then
|
---|
853 | echo " EVERYTHING is ok. "$date" can be deleted. "
|
---|
854 | echo "" >> $logfile 2>&1
|
---|
855 | echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile 2>&1
|
---|
856 | echo " EVERYTHING is ok. "$date" can be deleted. " >> $logfile2 2>&1
|
---|
857 | echo " Details in the logfile "$logfile
|
---|
858 | echo "" >> $logfile 2>&1
|
---|
859 | echo " Details in the logfile "$logfile >> $logfile2 2>&1
|
---|
860 | sendemail="yes"
|
---|
861 | else
|
---|
862 | if [ "$result1" = "0-0000" ] && [ "$result3" = "0010" ] && [ "$result4" = "0000" ] && [ ${archive[0]} -eq $numisdc ]
|
---|
863 | then
|
---|
864 | echo " "${fails[0]}" file(s) corrupt (fails folder), but files are transfered correctly. "
|
---|
865 | echo " "${fails[0]}" file(s) corrupt (fails folder), but files are transfered correctly. " >> $logfile 2>&1
|
---|
866 | echo " "${fails[0]}" file(s) corrupt (fails folder), but files are transfered correctly. " >> $logfile2 2>&1
|
---|
867 | echo " TRANSFER is ok. "$date" can be deleted. "
|
---|
868 | echo "" >> $logfile 2>&1
|
---|
869 | echo " TRANSFER is ok. "$date" can be deleted. " >> $logfile 2>&1
|
---|
870 | echo " TRANSFER is ok. "$date" can be deleted. " >> $logfile2 2>&1
|
---|
871 | echo " Details in the logfile "$logfile
|
---|
872 | echo "" >> $logfile 2>&1
|
---|
873 | echo " Details in the logfile "$logfile >> $logfile2 2>&1
|
---|
874 | sendemail="yes"
|
---|
875 | else
|
---|
876 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile
|
---|
877 | echo "" >> $logfile 2>&1
|
---|
878 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile 2>&1
|
---|
879 | echo " "$date" is not yet transfered completely. Please check the logfile "$logfile >> $logfile2 2>&1
|
---|
880 | echo " resetting jobs in the DB might be needed."
|
---|
881 | echo " resetting jobs in the DB might be needed." >> $logfile 2>&1
|
---|
882 | echo " resetting jobs in the DB might be needed." >> $logfile2 2>&1
|
---|
883 | fi
|
---|
884 | fi
|
---|
885 | if [ $daqdiffcounter -gt 0 ]
|
---|
886 | then
|
---|
887 | echo " WARN "$daqdiffcounter" files have a different size on daq (raw)."
|
---|
888 | echo " WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile 2>&1
|
---|
889 | echo " WARN "$daqdiffcounter" files have a different size on daq (raw)." >> $logfile2 2>&1
|
---|
890 | fi
|
---|
891 | if [ $dl00diffcounter -gt 0 ]
|
---|
892 | then
|
---|
893 | echo " WARN "$dl00diffcounter" files have a different size on dl00."
|
---|
894 | echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile 2>&1
|
---|
895 | echo " WARN "$dl00diffcounter" files have a different size on dl00." >> $logfile2 2>&1
|
---|
896 | fi
|
---|
897 | if [ $wuediffcounter -gt 0 ]
|
---|
898 | then
|
---|
899 | echo " WARN "$wuediffcounter" files have a different size in Wue."
|
---|
900 | echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile 2>&1
|
---|
901 | echo " WARN "$wuediffcounter" files have a different size in Wue." >> $logfile2 2>&1
|
---|
902 | fi
|
---|
903 | if [ $archivediffcounter -gt 0 ]
|
---|
904 | then
|
---|
905 | echo " WARN "$archivediffcounter" files have a different size in the archive."
|
---|
906 | echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile 2>&1
|
---|
907 | echo " WARN "$archivediffcounter" files have a different size in the archive." >> $logfile2 2>&1
|
---|
908 | fi
|
---|
909 | if ! [ $numdatruns -eq $qla ]
|
---|
910 | then
|
---|
911 | echo "WARN not all data runs are processed yet by the QLA. "
|
---|
912 | echo "WARN not all data runs are processed yet by the QLA. " >> $logfile 2>&1
|
---|
913 | echo "WARN not all data runs are processed yet by the QLA. " >> $logfile2 2>&1
|
---|
914 | fi
|
---|
915 | echo ""
|
---|
916 | echo "" >> $logfile 2>&1
|
---|
917 | echo "" >> $logfile2 2>&1
|
---|
918 | done
|
---|
919 |
|
---|
920 | #sendemail="yes"
|
---|
921 | if [ "$sendemail" = "yes" ]
|
---|
922 | then
|
---|
923 | echo ""
|
---|
924 | echo "INFO send email with "$logfile2"to shift@fact-project.org "
|
---|
925 | printprocesslog "INFO send email with "$logfile2"to shift@fact-project.org "
|
---|
926 | cat $logfile2 | mail -s "testmail for info on deleting data" shift@fact-project.org
|
---|
927 | fi
|
---|
928 |
|
---|
929 | printprocesslog "INFO finished $0"
|
---|
930 |
|
---|