source: tags/Mars-V0.9.4.1/datacenter/scripts/buildsequenceentries

Last change on this file was 7265, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.0 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 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2004
23#
24#
25# ========================================================================
26#
27#
28
29user=`whoami`
30source /home/$user/Mars/datacenter/scripts/sourcefile
31
32set -C
33
34cd $mars
35
36table=SequenceBuildStatus
37column=fSequenceEntriesBuilt
38date=NULL
39datetime=`date +%F-%H-%M-%S`
40year=`date +%Y`
41
42todofile=$listpath/ToDo-$table-$column.txt
43getstatuslogpath=$logpath/getstatus/buildsequenceentries/$year
44getstatuslog=$getstatuslogpath/getstatus-buildsequenceentries-$datetime.log
45
46scriptlogpath=$logpath/run/buildsequenceentries/`date +%Y/%m`
47makedir $scriptlogpath
48scriptlog=$scriptlogpath/buildsequenceentries-$datetime.log
49
50date >> $scriptlog 2>&1
51
52makedir $getstatuslogpath >> $scriptlog 2>&1
53
54date > $lockpath/lock-buildsequenceentries.txt >> $scriptlog 2>&1
55checklock0=$?
56case $checklock0 in
57 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
58 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
59 echo "-> getting list for buildsequenceentries is running -> exit" >> $scriptlog 2>&1
60 date >> $scriptlog 2>&1
61 exit;;
62 *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
63esac
64
65
66echo "getting list..." >> $scriptlog 2>&1
67check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatus.log | grep int | sed -e 's/(int)//'`
68
69case $check0 in
70 1) echo "check0=$check0 -> everything ok -> do step" >> $scriptlog 2>&1;;
71 *) echo "check0=$check0 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
72esac
73
74dates=(`cat $todofile`)
75
76if [ "$dates" = "" ]
77then
78 echo "nothing to do -> exit" >> $scriptlog 2>&1
79 rm -v $todofile >> $scriptlog 2>&1
80 rm -v $lockpath/lock-buildsequenceentries.txt >> $scriptlog 2>&1
81 date >> $scriptlog 2>&1
82 exit
83fi
84
85echo "dates: "${dates[@]} >> $scriptlog 2>&1
86
87for date in ${dates[@]}
88do
89 echo "building sequence entries for date $date..." >> $scriptlog 2>&1
90 year2=`echo $date | cut -c 1-4`
91 buildsequentriespath=$logpath/buildsequenceentries/$year2
92 makedir $buildsequentriespath >> $scriptlog 2>&1
93
94 check1=`root -q -b $macrospath/buildsequenceentries.C+\("\"$date\""\,"\"$datapath\""\,"\"$sequpath\""\,kFALSE\) | tee $buildsequentriespath/buildsequenceentries-$date.log | grep int | sed -e 's/(int)//'`
95
96 case $check1 in
97 1) echo "check1=$check1 -> everything ok -> setting status..." >> $scriptlog 2>&1
98 setstatuslogpath=$logpath/setstatus/buildsequenceentries/$year2
99 makedir $setstatuslogpath >> $scriptlog 2>&1
100
101 check2=`root -q -b $macrospath/setstatus.C+\("\"$date\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslogpath/setstatus-buildsequenceentries-$date.log | grep int | sed -e 's/(int)//'`
102 case $check2 in
103 1) echo "check2=$check2 -> everything ok, status has been set" >> $scriptlog 2>&1;;
104 *) echo "check2=$check2 -> ERROR -> step could not be set" >> $scriptlog 2>&1;;
105 esac
106 ;;
107 *) echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
108 esac
109done
110
111rm -v $todofile >> $scriptlog 2>&1
112rm -v $lockpath/lock-buildsequenceentries.txt >> $scriptlog 2>&1
113
114set +C
115
116date >> $scriptlog 2>&1
117
Note: See TracBrowser for help on using the repository browser.