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