1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ========================================================================
|
---|
4 | #
|
---|
5 | # *
|
---|
6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | # * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | # * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | # *
|
---|
11 | # * Permission to use, copy, modify and distribute this software and its
|
---|
12 | # * documentation for any purpose is hereby granted without fee,
|
---|
13 | # * provided that the above copyright notice appear in all copies and
|
---|
14 | # * that both that copyright notice and this permission notice appear
|
---|
15 | # * in supporting documentation. It is provided "as is" without express
|
---|
16 | # * or implied warranty.
|
---|
17 | # *
|
---|
18 | #
|
---|
19 | #
|
---|
20 | # Author(s): Daniela Dorner 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2004
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | #
|
---|
28 |
|
---|
29 | user=`whoami`
|
---|
30 | source /home/$user/Mars/datacenter/scripts/sourcefile
|
---|
31 |
|
---|
32 | cd $mars
|
---|
33 | date=`date +%F`
|
---|
34 |
|
---|
35 | subsystemdir=/magic/subsystemdata
|
---|
36 | filesondisklogpath=$logpath/filesondisk/`date +%Y`
|
---|
37 | makedir $filesondisklogpath
|
---|
38 |
|
---|
39 |
|
---|
40 | echo "checking disk for ccfiles..."
|
---|
41 |
|
---|
42 | filename=$filesondisklogpath/ccfilesondisk-$date.txt
|
---|
43 | column=fCCFileAvail
|
---|
44 |
|
---|
45 | find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename
|
---|
46 |
|
---|
47 |
|
---|
48 | echo "resetting runs..."
|
---|
49 | check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
---|
50 |
|
---|
51 | case $check3 in
|
---|
52 | 1) echo "check3=$check3 -> everything ok -> reset is done";;
|
---|
53 | *) echo "check3=$check3 -> ERROR -> something went wrong while resetting";;
|
---|
54 | esac
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 | echo "checking disk for cacofiles..."
|
---|
59 |
|
---|
60 | filename=$filesondisklogpath/cacofilesondisk-$date.txt
|
---|
61 | column=fCaCoFileAvail
|
---|
62 |
|
---|
63 | find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
|
---|
64 |
|
---|
65 |
|
---|
66 | echo "resetting runs..."
|
---|
67 | check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
---|
68 |
|
---|
69 | case $check0 in
|
---|
70 | 1) echo "check0=$check0 -> everything ok -> reset is done";;
|
---|
71 | *) echo "check0=$check0 -> ERROR -> something went wrong while resetting";;
|
---|
72 | esac
|
---|
73 |
|
---|
74 |
|
---|
75 |
|
---|
76 | echo "checking missing cacofiles..."
|
---|
77 | check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\,"\"$filesondisklogpath\""\) | tee $filesondisklogpath/findcacofiles-$date.log | grep int | sed -e 's/(int)//'`
|
---|
78 |
|
---|
79 | case $check1 in
|
---|
80 | 1) echo "check1=$check1 -> everything ok -> missing cacofiles are found";;
|
---|
81 | *) echo "check1=$check1 -> ERROR -> something went wrong while resetting";;
|
---|
82 | esac
|
---|
83 |
|
---|
84 | missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
|
---|
85 |
|
---|
86 | for missingcacorun in ${missingcacoruns[@]}
|
---|
87 | do
|
---|
88 | runno=$missingcacorun
|
---|
89 | echo "no cacofile found for run "$runno
|
---|
90 | echo "finding cacofile"
|
---|
91 | ccfile=`find $subsystemdir/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
|
---|
92 | echo "ccfile: "$ccfile
|
---|
93 | if [ "$ccfile" = "" ]
|
---|
94 | then
|
---|
95 | echo "no ccfile found for run "$runno
|
---|
96 | continue
|
---|
97 | fi
|
---|
98 | for (( i = 0; i <= 10; i++ ))
|
---|
99 | do
|
---|
100 | newrun=`echo $runno - $i | bc`
|
---|
101 | path=`dirname $ccfile`
|
---|
102 | path=`echo $path | sed -e 's/cc/caco/'`
|
---|
103 | cacofile=`find $path -name *$newrun*`
|
---|
104 | if [ "$cacofile" = "" ]
|
---|
105 | then
|
---|
106 | continue
|
---|
107 | else
|
---|
108 | echo "inserting cacofile $file for run $missingcacorun..."
|
---|
109 | check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
|
---|
110 |
|
---|
111 | case $check2 in
|
---|
112 | 1) echo "check2=$check2 -> everything ok -> insert is done";;
|
---|
113 | *) echo "check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun;;
|
---|
114 | esac
|
---|
115 | break
|
---|
116 | fi
|
---|
117 | done
|
---|
118 | echo "cacofile: "$cacofile
|
---|
119 |
|
---|
120 | done
|
---|
121 |
|
---|
122 |
|
---|
123 |
|
---|
124 | echo "checking disk for rawfiles..."
|
---|
125 |
|
---|
126 | filename=$filesondisklogpath/rawfilesondisk-$date.txt
|
---|
127 | column=fRawFileAvail
|
---|
128 |
|
---|
129 | find $datapath -name '*.raw' | cut -d_ -f2 > $filename
|
---|
130 |
|
---|
131 | echo "resetting runs..."
|
---|
132 | check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
---|
133 |
|
---|
134 | case $check4 in
|
---|
135 | 1) echo "check4=$check4 -> everything ok -> reset is done";;
|
---|
136 | *) echo "check4=$check4 -> ERROR -> something went wrong while resetting";;
|
---|
137 | esac
|
---|
138 |
|
---|
139 |
|
---|