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 |
|
---|
29 | user=`whoami`
|
---|
30 | source /home/$user/Mars/datacenter/scripts/sourcefile
|
---|
31 |
|
---|
32 | set -C
|
---|
33 |
|
---|
34 | cd $mars
|
---|
35 |
|
---|
36 | table=SequenceBuildStatus
|
---|
37 | column=fExclusionsDone
|
---|
38 | date=NULL
|
---|
39 | datetime=`date +%F-%H-%M-%S`
|
---|
40 | year=`date +%Y`
|
---|
41 |
|
---|
42 | todofile=$listpath/ToDo-$table-$column.txt
|
---|
43 | getstatuslogpath=$logpath/getstatus/doexclusions/$year
|
---|
44 | getstatuslog=$getstatuslogpath/getstatus-doexcludions-$datetime.log
|
---|
45 |
|
---|
46 | scriptlogpath=$logpath/run/doexclusions/`date +%Y/%m`
|
---|
47 | makedir $scriptlogpath
|
---|
48 |
|
---|
49 | scriptlog=$scriptlogpath/doexclusions-$datetime.log
|
---|
50 |
|
---|
51 | date >> $scriptlog 2>&1
|
---|
52 |
|
---|
53 | makedir $getstatuslogpath >> $scriptlog 2>&1
|
---|
54 |
|
---|
55 | date > $lockpath/lock-doexclusions.txt >> $scriptlog 2>&1
|
---|
56 | checklock0=$?
|
---|
57 | case $checklock0 in
|
---|
58 | 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
|
---|
59 | 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
|
---|
60 | echo "-> getting list for callisto is running -> exit" >> $scriptlog 2>&1
|
---|
61 | date >> $scriptlog 2>&1
|
---|
62 | exit;;
|
---|
63 | *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
|
---|
64 | esac
|
---|
65 |
|
---|
66 |
|
---|
67 | echo "getting list..." >> $scriptlog 2>&1
|
---|
68 | check0=`root -q -b $macrospath/getdolist.C+\("\"$table\""\,"\"$column\""\,"\"$date\""\,"\"$listpath\""\) | tee $getstatuslog | grep int | sed -e 's/(int)//'`
|
---|
69 |
|
---|
70 | case $check0 in
|
---|
71 | 1) echo "check0=$check0 -> everthing ok -> do step" >> $scriptlog 2>&1;;
|
---|
72 | *) echo "check0=$check0 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
|
---|
73 | esac
|
---|
74 |
|
---|
75 | dates=(`cat $todofile`)
|
---|
76 |
|
---|
77 | if [ "$dates" = "" ]
|
---|
78 | then
|
---|
79 | echo "nothing to do -> exit" >> $scriptlog 2>&1
|
---|
80 | rm -v $todofile >> $scriptlog 2>&1
|
---|
81 | rm -v $lockpath/lock-doexclusions.txt >> $scriptlog 2>&1
|
---|
82 | date >> $scriptlog 2>&1
|
---|
83 | exit
|
---|
84 | fi
|
---|
85 |
|
---|
86 | echo "dates: "${dates[@]} >> $scriptlog 2>&1
|
---|
87 |
|
---|
88 | for date in ${dates[@]}
|
---|
89 | do
|
---|
90 | echo "do exclusions for date "$date
|
---|
91 | year2=`echo $date | cut -c 1-4`
|
---|
92 | doexclusionspath=$logpath/doexclusions/$year2
|
---|
93 | makedir $doexclusionspath >> $scriptlog 2>&1
|
---|
94 |
|
---|
95 | check1=`root -q -b $macrospath/doexclusions.C+\("\"$date\""\) | tee $doexclusionspath/doexclusions-$date.log | grep int | sed -e 's/(int)//'`
|
---|
96 |
|
---|
97 | case $check1 in
|
---|
98 | 1) echo "check1=1 -> everthing ok -> setting status..."
|
---|
99 | setstatuslogpath=$logpath/setstatus/doexclusions/$year2
|
---|
100 | makedir $setstatuslogpath >> $scriptlog 2>&1
|
---|
101 |
|
---|
102 | check2=`root -q -b $macrospath/setstatus.C+\("\"$date\""\,"\"$table\""\,"\"$column\""\,"\"Now()\""\) | tee $setstatuslogpath/setstatus-doexclusions-$date.log | grep int | sed -e 's/(int)//'`
|
---|
103 |
|
---|
104 | case $check2 in
|
---|
105 | 1) echo "check2=$check2 -> everthing ok, status has been set";;
|
---|
106 | *) echo "check2=$check2 -> ERROR -> step could not be set";;
|
---|
107 | esac
|
---|
108 | ;;
|
---|
109 | *) echo "check1=$check1 -> ERROR -> step has to be repeated";;
|
---|
110 | esac
|
---|
111 | done
|
---|
112 |
|
---|
113 | rm -v $todofile >> $scriptlog 2>&1
|
---|
114 | rm -v $lockpath/lock-doexclusions.txt >> $scriptlog 2>&1
|
---|
115 |
|
---|
116 | set +C
|
---|
117 |
|
---|
118 | date >> $scriptlog 2>&1
|
---|
119 |
|
---|