source: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile@ 7482

Last change on this file since 7482 was 7482, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.6 KB
Line 
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
31export ROOTSYS=/opt/root_v4.04.02g
32export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
33export PATH=$PATH:$ROOTSYS/bin
34
35mars=/home/operator/Mars
36macrospath=$mars/datacenter/macros
37scriptspath=$mars/datacenter/scripts
38
39logpath=/magic/datacenter/autologs
40lockpath=/magic/datacenter/locks
41listpath=/magic/datacenter/lists
42setuppath=/magic/datacenter/setup
43
44datapath=/magic/data
45subsystempath=/magic/subsystemdata
46sequpath=/magic/sequences
47datasetpath=/magic/datasets
48
49check="ok"
50
51
52#failed codes
53#sequence build status
54Fbuildsequ=1
55Fdoexcl=2
56#run process status
57Ftimecorr=3
58Ffillraw=4
59Fsinope=5
60Ffillsinope=6
61Fresetexcl=7
62#sequence process status
63Fwritesequfile=8
64Ffilesavail=9
65Fnoccfile=10
66Fnocacofile=11
67Fmerppcc=12
68Fmerppcaco=13
69Fcallisto=14
70Ffillcalib=15
71Ffillsignal=16
72Fstar=17
73Ffillstar=18
74#dataset process status
75Fstardone=19
76Fganymed=20
77Ffillganymed=21
78
79
80
81function finish()
82{
83 rm -v $todofile
84 rm -v $lockfile
85 date
86 exit
87}
88
89function 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
102function 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
124function resetstatusvalues()
125{
126 statustime=NULL
127 starttime=NULL
128 returncode=NULL
129 failedcode=NULL
130 failedcodeadd=NULL
131 failedtime=NULL
132}
133
134function 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
147function 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
Note: See TracBrowser for help on using the repository browser.