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.02
|
---|
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 |
|
---|
50 | function makedir()
|
---|
51 | {
|
---|
52 | if [ ! -d $@ ]
|
---|
53 | then
|
---|
54 | mkdir -pv $@
|
---|
55 | if [ ! -d $@ ]
|
---|
56 | then
|
---|
57 | echo "could not make dir "$@
|
---|
58 | exit
|
---|
59 | fi
|
---|
60 | fi
|
---|
61 | }
|
---|
62 |
|
---|
63 | function resetstatusvalues()
|
---|
64 | {
|
---|
65 | statustime=NULL
|
---|
66 | starttime=NULL
|
---|
67 | failedcode=NULL
|
---|
68 | failedcomment=NULL
|
---|
69 | failedtime=NULL
|
---|
70 | }
|
---|
71 |
|
---|
72 | function printstatusvalues()
|
---|
73 | {
|
---|
74 | echo "the current values are:"
|
---|
75 | echo " statustime=$statustime"
|
---|
76 | echo " starttime=$starttime"
|
---|
77 | echo " failedcode=$failedcode"
|
---|
78 | echo " failedcomment=$failedcomment"
|
---|
79 | echo " failedtime=$failedtime"
|
---|
80 | echo "-- check: -$check-"
|
---|
81 | ech
|
---|
82 | echo ""
|
---|
83 | }
|
---|
84 |
|
---|
85 | function setstatus()
|
---|
86 | {
|
---|
87 | # set status values
|
---|
88 | resetstatusvalues
|
---|
89 | case $@ in
|
---|
90 | start) echo "start"
|
---|
91 | starttime="Now()"
|
---|
92 | ;;
|
---|
93 | stop) echo "stop"
|
---|
94 | case $check in
|
---|
95 | 0) echo " ok"
|
---|
96 | statustime="Now()"
|
---|
97 | ;;
|
---|
98 | *) echo " failed"
|
---|
99 | starttime=noreset
|
---|
100 | failedcode=$check
|
---|
101 | failedcomment=$com
|
---|
102 | failedtime="Now()"
|
---|
103 | ;;
|
---|
104 | esac
|
---|
105 | ;;
|
---|
106 | *) echo "error -> exit"
|
---|
107 | exit
|
---|
108 | ;;
|
---|
109 | esac
|
---|
110 | check=
|
---|
111 |
|
---|
112 | # printstatusvalues
|
---|
113 | # set status
|
---|
114 | setstatuslogpath=$logpath/setstatus/$program/$var1
|
---|
115 | makedir $setstatuslogpath
|
---|
116 | setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
|
---|
117 | checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failedcode\""\,"\"$failedcomment\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
|
---|
118 | case $checkstatus in
|
---|
119 | 1) echo "checkstatus=$checkstatus -> everything ok, status has been set"
|
---|
120 | *) echo "checkstatus=$checkstatus -> ERROR -> step could not be set"
|
---|
121 | esac
|
---|
122 | }
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|