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-2007
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | # This script is launching ganymed for datasets.
|
---|
28 | #
|
---|
29 | # As ganymed takes some time, only one dataset is processed at once.
|
---|
30 | # First the script gets a dataset number from the database, for which
|
---|
31 | # ganymed has to be done (function gettodo). After setting the status in
|
---|
32 | # the database (set fStartTime to know, that the dataset is already being
|
---|
33 | # processed), the background suppression is done for the dataset.
|
---|
34 | # Afterwards the status in the database is updated according to the return
|
---|
35 | # value of ganymed.
|
---|
36 | # The important INFOs, WARNings and ERRORs are written not only to the
|
---|
37 | # scriptlog but also to the processlog.
|
---|
38 | #
|
---|
39 | # The ganymed.rc files are stored in the setup directory.
|
---|
40 | #
|
---|
41 |
|
---|
42 | source `dirname $0`/sourcefile
|
---|
43 | printprocesslog "INFO starting $0"
|
---|
44 | program=ganymed
|
---|
45 | column=fGanymed
|
---|
46 |
|
---|
47 | set -C
|
---|
48 |
|
---|
49 | scriptlog=$runlogpath/run$program-$datetime.log
|
---|
50 | date >> $scriptlog 2>&1
|
---|
51 |
|
---|
52 | # get dataset #
|
---|
53 | gettodo "1" >> $scriptlog 2>&1
|
---|
54 | dataset=${primaries[0]}
|
---|
55 | telnum=${primaries[1]}
|
---|
56 |
|
---|
57 | # lock sequ
|
---|
58 | lockfile=$lockpath/lock-$table-$column-$dataset.txt
|
---|
59 | checklock >> $scriptlog 2>&1
|
---|
60 |
|
---|
61 | cd $mars
|
---|
62 |
|
---|
63 | echo "run $program for dataset $dataset..." >> $scriptlog 2>&1
|
---|
64 | printprocesslog "INFO starting $program for dataset $dataset"
|
---|
65 | no=`printf %08d $dataset | cut -c 0-5`
|
---|
66 | no2=`printf %08d $dataset`
|
---|
67 | outpath="$datapath/$program/$no/$no2"
|
---|
68 | makedir $outpath >> $scriptlog 2>&1
|
---|
69 |
|
---|
70 | datasetfile="$datasetpath/$no/dataset$no2.txt"
|
---|
71 | # choose ganymed.rc file
|
---|
72 | if grep 'WobbleMode:' $datasetfile >/dev/null
|
---|
73 | then
|
---|
74 | ganymedrc=$setuppath/ganymed/ganymed_wobble.rc
|
---|
75 | else
|
---|
76 | ganymedrc=$setuppath/ganymed/ganymed_onoff.rc
|
---|
77 | fi
|
---|
78 |
|
---|
79 | setstatus "start" >> $scriptlog 2>&1
|
---|
80 |
|
---|
81 | echo "./ganymed -b -q -v4 -f --ind=$datapath/star --ins=$sequpath --config=$ganymedrc --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath $datasetfile " >> $scriptlog 2>&1
|
---|
82 | ./ganymed -b -q -v4 -f --ind=$datapath/star --ins=$sequpath --config=$ganymedrc --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath $datasetfile 2>> $scriptlog> /dev/null
|
---|
83 | check1=$?
|
---|
84 |
|
---|
85 | case $check1 in
|
---|
86 | 0) echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
|
---|
87 | printprocesslog "INFO $program finished successfully for dataset $dataset"
|
---|
88 | ;;
|
---|
89 | *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
---|
90 | printprocesslog "ERROR $program failed for dataset $dataset (return code $check1)"
|
---|
91 | com=$Fganymed
|
---|
92 | check=$check1
|
---|
93 | ;;
|
---|
94 | esac
|
---|
95 |
|
---|
96 | setstatus "stop" >> $scriptlog 2>&1
|
---|
97 |
|
---|
98 | finish >> $scriptlog 2>&1
|
---|
99 |
|
---|