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 05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2006
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | # This a resource file for the scripts, in which the standard paths and
|
---|
28 | # functions, which are needed more often are stored.
|
---|
29 | #
|
---|
30 |
|
---|
31 | export ROOTSYS=/opt/root_v4.04.02g
|
---|
32 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
|
---|
33 | export PATH=$PATH:$ROOTSYS/bin
|
---|
34 |
|
---|
35 | mars=/home/operator/Mars
|
---|
36 | macrospath=$mars/datacenter/macros
|
---|
37 | scriptspath=$mars/datacenter/scripts
|
---|
38 |
|
---|
39 | logpath=/magic/datacenter/autologs
|
---|
40 | lockpath=/magic/datacenter/locks
|
---|
41 | listpath=/magic/datacenter/lists
|
---|
42 | setuppath=/magic/datacenter/setup
|
---|
43 |
|
---|
44 | datapath=/magic/data
|
---|
45 | subsystempath=/magic/subsystemdata
|
---|
46 | sequpath=/magic/sequences
|
---|
47 | datasetpath=/magic/datasets
|
---|
48 |
|
---|
49 | check="ok"
|
---|
50 |
|
---|
51 |
|
---|
52 | #failed codes
|
---|
53 | #sequence build status
|
---|
54 | Fbuildsequ=1
|
---|
55 | Fdoexcl=2
|
---|
56 | #run process status
|
---|
57 | Ftimecorr=3
|
---|
58 | Ffillraw=4
|
---|
59 | Fsinope=5
|
---|
60 | Ffillsinope=6
|
---|
61 | Fresetexcl=7
|
---|
62 | #sequence process status
|
---|
63 | Fwritesequfile=8
|
---|
64 | Ffilesavail=9
|
---|
65 | Fnoccfile=10
|
---|
66 | Fnocacofile=11
|
---|
67 | Fmerppcc=12
|
---|
68 | Fmerppcaco=13
|
---|
69 | Fcallisto=14
|
---|
70 | Ffillcalib=15
|
---|
71 | Ffillsignal=16
|
---|
72 | Fstar=17
|
---|
73 | Ffillstar=18
|
---|
74 | #dataset process status
|
---|
75 | Fstardone=19
|
---|
76 | Fganymed=20
|
---|
77 | Ffillganymed=21
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 | function finish()
|
---|
82 | {
|
---|
83 | rm -v $todofile
|
---|
84 | rm -v $lockfile
|
---|
85 | date
|
---|
86 | exit
|
---|
87 | }
|
---|
88 |
|
---|
89 | function makedir()
|
---|
90 | {
|
---|
91 | if [ ! -d $@ ]
|
---|
92 | then
|
---|
93 | mkdir -pv $@
|
---|
94 | if [ ! -d $@ ]
|
---|
95 | then
|
---|
96 | echo "could not make dir "$@
|
---|
97 | finish
|
---|
98 | fi
|
---|
99 | fi
|
---|
100 | }
|
---|
101 |
|
---|
102 | function getdolist()
|
---|
103 | {
|
---|
104 | datetime=`date +%F-%H-%M-%S`
|
---|
105 | year=`date +%Y`
|
---|
106 | date=NULL
|
---|
107 |
|
---|
108 | getstatuslogpath=$logpath/getstatus/$program/$year
|
---|
109 | getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
|
---|
110 | makedir $getstatuslogpath
|
---|
111 |
|
---|
112 | # get todo list
|
---|
113 | echo "getting todo list..."
|
---|
114 | check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatus | grep int | sed -e 's/(int)//'`
|
---|
115 |
|
---|
116 | case $check0 in
|
---|
117 | 1) echo "check0=$check0 -> everything ok, got todo list -> run $program";;
|
---|
118 | *) echo "check0=$check0 -> ERROR -> could not get todo list -> exit"
|
---|
119 | finish ;;
|
---|
120 | esac
|
---|
121 |
|
---|
122 | }
|
---|
123 |
|
---|
124 | function resetstatusvalues()
|
---|
125 | {
|
---|
126 | statustime=NULL
|
---|
127 | starttime=NULL
|
---|
128 | returncode=NULL
|
---|
129 | failedcode=NULL
|
---|
130 | failedcodeadd=NULL
|
---|
131 | failedtime=NULL
|
---|
132 | }
|
---|
133 |
|
---|
134 | function printstatusvalues()
|
---|
135 | {
|
---|
136 | echo "the current values are:"
|
---|
137 | echo " statustime=$statustime"
|
---|
138 | echo " starttime=$starttime"
|
---|
139 | echo " returncode=$returncode"
|
---|
140 | echo " failedcode=$failedcode"
|
---|
141 | echo " failedcodeadd=$failedcodeadd"
|
---|
142 | echo " failedtime=$failedtime"
|
---|
143 | echo "-- check: -$check-"
|
---|
144 | echo ""
|
---|
145 | }
|
---|
146 |
|
---|
147 | function setstatus()
|
---|
148 | {
|
---|
149 | # set status values
|
---|
150 | resetstatusvalues
|
---|
151 | case $@ in
|
---|
152 | start) echo "start"
|
---|
153 | starttime="Now()"
|
---|
154 | ;;
|
---|
155 | stop) echo "stop"
|
---|
156 | case $check in
|
---|
157 | ok) echo " ok"
|
---|
158 | statustime="Now()"
|
---|
159 | ;;
|
---|
160 | *) echo " failed"
|
---|
161 | starttime=noreset
|
---|
162 | returncode=$check
|
---|
163 | failedcode=$com
|
---|
164 | failedcodeadd=$comadd
|
---|
165 | failedtime="Now()"
|
---|
166 | ;;
|
---|
167 | esac
|
---|
168 | ;;
|
---|
169 | *) echo "error -> exit"
|
---|
170 | exit
|
---|
171 | ;;
|
---|
172 | esac
|
---|
173 |
|
---|
174 | # printstatusvalues
|
---|
175 | # set status
|
---|
176 | setstatuslogpath=$logpath/setstatus/$program/$var1
|
---|
177 | makedir $setstatuslogpath
|
---|
178 | setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
|
---|
179 | checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$returncode\""\,"\"$failedcode\""\,"\"$failedcodeadd\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
|
---|
180 | case $checkstatus in
|
---|
181 | 1) echo "checkstatus=$checkstatus -> everything ok, status has been set";;
|
---|
182 | *) echo "checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
|
---|
183 | finish ;;
|
---|
184 | esac
|
---|
185 | }
|
---|
186 |
|
---|
187 |
|
---|
188 |
|
---|