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

Last change on this file since 7479 was 7479, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.1 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
52function finish()
53{
54 rm -v $todofile
55 rm -v $lockfile
56 date
57 exit
58}
59
60function makedir()
61{
62 if [ ! -d $@ ]
63 then
64 mkdir -pv $@
65 if [ ! -d $@ ]
66 then
67 echo "could not make dir "$@
68 finish
69 fi
70 fi
71}
72
73function getdolist()
74{
75 datetime=`date +%F-%H-%M-%S`
76 year=`date +%Y`
77 date=NULL
78
79 getstatuslogpath=$logpath/getstatus/$program/$year
80 getstatuslog=$getstatuslogpath/getstatus-$table-$column-$datetime.log
81 makedir $getstatuslogpath
82
83 # get todo list
84 echo "getting todo list..."
85 check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatus | grep int | sed -e 's/(int)//'`
86
87 case $check0 in
88 1) echo "check0=$check0 -> everything ok, got todo list -> run $program";;
89 *) echo "check0=$check0 -> ERROR -> could not get todo list -> exit"
90 finish ;;
91 esac
92
93}
94
95function resetstatusvalues()
96{
97 statustime=NULL
98 starttime=NULL
99 failedcode=NULL
100 failedcomment=NULL
101 failedtime=NULL
102}
103
104function printstatusvalues()
105{
106 echo "the current values are:"
107 echo " statustime=$statustime"
108 echo " starttime=$starttime"
109 echo " failedcode=$failedcode"
110 echo " failedcomment=$failedcomment"
111 echo " failedtime=$failedtime"
112 echo "-- check: -$check-"
113 echo ""
114}
115
116function setstatus()
117{
118 # set status values
119 resetstatusvalues
120 case $@ in
121 start) echo "start"
122 starttime="Now()"
123 ;;
124 stop) echo "stop"
125 case $check in
126 ok) echo " ok"
127 statustime="Now()"
128 ;;
129 *) echo " failed"
130 starttime=noreset
131 failedcode=$check
132 failedcomment=$com
133 failedtime="Now()"
134 ;;
135 esac
136 ;;
137 *) echo "error -> exit"
138 exit
139 ;;
140 esac
141
142# printstatusvalues
143 # set status
144 setstatuslogpath=$logpath/setstatus/$program/$var1
145 makedir $setstatuslogpath
146 setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
147 checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failedcode\""\,"\"$failedcomment\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
148 case $checkstatus in
149 1) echo "checkstatus=$checkstatus -> everything ok, status has been set";;
150 *) echo "checkstatus=$checkstatus -> ERROR -> step could not be set -> exit"
151 finish ;;
152 esac
153}
154
155
156
Note: See TracBrowser for help on using the repository browser.