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 | source /home/operator/Mars/datacenter/scripts/sourcefile
|
---|
30 |
|
---|
31 | cd $mars
|
---|
32 | date=`date +%F`
|
---|
33 |
|
---|
34 | subsystemdir=/magic/subsystemdata
|
---|
35 | rawdir=/magic/data
|
---|
36 | filesondisklogpath=$logpath/filesondisk/`date +%Y`
|
---|
37 |
|
---|
38 | if [ ! -d $filesondisklogpath ]
|
---|
39 | then
|
---|
40 | mkdir -pv $filesondisklogpath
|
---|
41 | if [ ! -d $filesondisklogpath ]
|
---|
42 | then
|
---|
43 | echo "could not make directory "$filesondisklogpath
|
---|
44 | exit
|
---|
45 | fi
|
---|
46 | fi
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 | echo "checking disk for ccfiles..."
|
---|
51 |
|
---|
52 | filename=$filesondisklogpath/ccfilesondisk-$date.txt
|
---|
53 | column=fCCFileAvail
|
---|
54 |
|
---|
55 | find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename
|
---|
56 |
|
---|
57 |
|
---|
58 | echo "resetting runs..."
|
---|
59 | check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
---|
60 |
|
---|
61 | case $check3 in
|
---|
62 | 1) echo "check3=$check3 -> everthing ok -> reset is done";;
|
---|
63 | *) echo "check3=$check3 -> ERROR -> something went wrong while resetting";;
|
---|
64 | esac
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 | echo "checking disk for cacofiles..."
|
---|
69 |
|
---|
70 | filename=$filesondisklogpath/cacofilesondisk-$date.txt
|
---|
71 | column=fCaCoFileAvail
|
---|
72 |
|
---|
73 | find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
|
---|
74 |
|
---|
75 |
|
---|
76 | echo "resetting runs..."
|
---|
77 | check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
---|
78 |
|
---|
79 | case $check0 in
|
---|
80 | 1) echo "check0=$check0 -> everthing ok -> reset is done";;
|
---|
81 | *) echo "check0=$check0 -> ERROR -> something went wrong while resetting";;
|
---|
82 | esac
|
---|
83 |
|
---|
84 |
|
---|
85 |
|
---|
86 | echo "checking missing cacofiles..."
|
---|
87 | check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\) | tee $filesondisklogpath/findcacofiles-$date.log | grep int | sed -e 's/(int)//'`
|
---|
88 |
|
---|
89 | case $check1 in
|
---|
90 | 1) echo "check1=$check1 -> everthing ok -> missing cacofiles are found";;
|
---|
91 | *) echo "check1=$check1 -> ERROR -> something went wrong while resetting";;
|
---|
92 | esac
|
---|
93 |
|
---|
94 | missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
|
---|
95 |
|
---|
96 | for missingcacorun in ${missingcacoruns[@]}
|
---|
97 | do
|
---|
98 | runno=$missingcacorun
|
---|
99 | echo "no cacofile found for run "$runno
|
---|
100 | echo "finding cacofile"
|
---|
101 | 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`
|
---|
102 | echo "ccfile: "$ccfile
|
---|
103 | if [ "$ccfile" = "" ]
|
---|
104 | then
|
---|
105 | echo "no ccfile found for run "$runno
|
---|
106 | continue
|
---|
107 | fi
|
---|
108 | for (( i = 0; i <= 10; i++ ))
|
---|
109 | do
|
---|
110 | newrun=`echo $runno - $i | bc`
|
---|
111 | path=`dirname $ccfile`
|
---|
112 | path=`echo $path | sed -e 's/cc/caco/'`
|
---|
113 | cacofile=`find $path -name *$newrun*`
|
---|
114 | if [ "$cacofile" = "" ]
|
---|
115 | then
|
---|
116 | continue
|
---|
117 | else
|
---|
118 | echo "inserting cacofile $file for run $missingcacorun..."
|
---|
119 | check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
|
---|
120 |
|
---|
121 | case $check2 in
|
---|
122 | 1) echo "check2=$check2 -> everthing ok -> insert is done";;
|
---|
123 | *) echo "check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun;;
|
---|
124 | esac
|
---|
125 | break
|
---|
126 | fi
|
---|
127 | done
|
---|
128 | echo "cacofile: "$cacofile
|
---|
129 |
|
---|
130 | done
|
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 | echo "checking disk for rawfiles..."
|
---|
135 |
|
---|
136 | filename=$filesondisklogpath/rawfilesondisk-$date.txt
|
---|
137 | column=fRawFileAvail
|
---|
138 |
|
---|
139 | find $rawdir -name '*.raw' | cut -d_ -f2 > $filename
|
---|
140 |
|
---|
141 | echo "resetting runs..."
|
---|
142 | check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
---|
143 |
|
---|
144 | case $check4 in
|
---|
145 | 1) echo "check4=$check4 -> everthing ok -> reset is done";;
|
---|
146 | *) echo "check4=$check4 -> ERROR -> something went wrong while resetting";;
|
---|
147 | esac
|
---|
148 |
|
---|
149 |
|
---|