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 | echo ""
|
---|
82 | }
|
---|
83 |
|
---|
84 | function setstatus()
|
---|
85 | {
|
---|
86 | # set status values
|
---|
87 | resetstatusvalues
|
---|
88 | case $@ in
|
---|
89 | start) echo "start"
|
---|
90 | starttime="Now()"
|
---|
91 | ;;
|
---|
92 | stop) echo "stop"
|
---|
93 | case $check in
|
---|
94 | 0) echo " ok"
|
---|
95 | statustime="Now()"
|
---|
96 | ;;
|
---|
97 | *) echo " failed"
|
---|
98 | starttime=noreset
|
---|
99 | failedcode=$check
|
---|
100 | failedcomment=$com
|
---|
101 | failedtime="Now()"
|
---|
102 | ;;
|
---|
103 | esac
|
---|
104 | ;;
|
---|
105 | *) echo "error -> exit"
|
---|
106 | exit
|
---|
107 | ;;
|
---|
108 | esac
|
---|
109 | check=
|
---|
110 |
|
---|
111 | # printstatusvalues
|
---|
112 | # set status
|
---|
113 | setstatuslogpath=$logpath/setstatus/$program/$var1
|
---|
114 | makedir $setstatuslogpath
|
---|
115 | setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
|
---|
116 | checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failedcode\""\,"\"$failedcomment\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
|
---|
117 | case $checkstatus in
|
---|
118 | 1) echo "checkstatus=$checkstatus -> everything ok, status has been set"
|
---|
119 | *) echo "checkstatus=$checkstatus -> ERROR -> step could not be set"
|
---|
120 | esac
|
---|
121 | }
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|