| 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-2006 | 
|---|
| 23 | # | 
|---|
| 24 | # | 
|---|
| 25 | # ======================================================================== | 
|---|
| 26 | # | 
|---|
| 27 | # This script is launching ganymed for datasets. | 
|---|
| 28 | # | 
|---|
| 29 | # In the case of ganymed only one dataset is processed. Despite of | 
|---|
| 30 | # that the structure of the script is such, that also more datasets could | 
|---|
| 31 | # be processed. The restriction to one dataset has been made, as ganymed | 
|---|
| 32 | # takes some time. There's one todo file per dataset. | 
|---|
| 33 | # First the script searches for a todo file. Then ganymed is run for the | 
|---|
| 34 | # dataset from this todo file. | 
|---|
| 35 | # | 
|---|
| 36 | # the ganymed.rc files are stored in the setup directory | 
|---|
| 37 | # | 
|---|
| 38 |  | 
|---|
| 39 | source `dirname $0`/sourcefile | 
|---|
| 40 | printprocesslog "INFO starting $0" | 
|---|
| 41 | program=ganymed | 
|---|
| 42 | column=fGanymed | 
|---|
| 43 |  | 
|---|
| 44 | set -C | 
|---|
| 45 |  | 
|---|
| 46 | scriptlog=$runlogpath/run$program-$datetime.log | 
|---|
| 47 | date >> $scriptlog 2>&1 | 
|---|
| 48 |  | 
|---|
| 49 | # get dataset # | 
|---|
| 50 | gettodo >> $scriptlog 2>&1 | 
|---|
| 51 | dataset=$process | 
|---|
| 52 |  | 
|---|
| 53 | # lock sequ | 
|---|
| 54 | lockfile=$lockpath/lock-$table-$column-$dataset.txt | 
|---|
| 55 | checklock >> $scriptlog 2>&1 | 
|---|
| 56 |  | 
|---|
| 57 | cd $mars | 
|---|
| 58 |  | 
|---|
| 59 | echo "run $program for dataset $dataset..." >> $scriptlog 2>&1 | 
|---|
| 60 | printprocesslog "INFO starting $program for dataset $dataset" | 
|---|
| 61 | no=`printf %08d $dataset | cut -c 0-5` | 
|---|
| 62 | no2=`printf %08d $dataset` | 
|---|
| 63 | var1=$no | 
|---|
| 64 | var2=$no2 | 
|---|
| 65 | outpath="$datapath/$program/$no/$no2" | 
|---|
| 66 | makedir $outpath >> $scriptlog 2>&1 | 
|---|
| 67 |  | 
|---|
| 68 | datasetfile="$datasetpath/$no/dataset$no2.txt" | 
|---|
| 69 | # choose ganymed.rc file | 
|---|
| 70 | if grep 'WobbleMode:' $datasetfile >/dev/null | 
|---|
| 71 | then | 
|---|
| 72 | ganymedrc=$setuppath/ganymed/ganymed_wobble.rc | 
|---|
| 73 | else | 
|---|
| 74 | ganymedrc=$setuppath/ganymed/ganymed_onoff.rc | 
|---|
| 75 | fi | 
|---|
| 76 |  | 
|---|
| 77 | setstatus "start" >> $scriptlog 2>&1 | 
|---|
| 78 |  | 
|---|
| 79 | 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 | 
|---|
| 80 | ./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 | 
|---|
| 81 | check1=$? | 
|---|
| 82 |  | 
|---|
| 83 | case $check1 in | 
|---|
| 84 | 0)   echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1 | 
|---|
| 85 | printprocesslog "INFO $program finished successfully for dataset $dataset" | 
|---|
| 86 | ;; | 
|---|
| 87 | *)   echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 | 
|---|
| 88 | printprocesslog "ERROR $program failed for dataset $dataset (return code $check1)" | 
|---|
| 89 | com=$Fganymed | 
|---|
| 90 | check=$check1 | 
|---|
| 91 | ;; | 
|---|
| 92 | esac | 
|---|
| 93 |  | 
|---|
| 94 | setstatus "stop" >> $scriptlog 2>&1 | 
|---|
| 95 |  | 
|---|
| 96 | finish >> $scriptlog 2>&1 | 
|---|
| 97 |  | 
|---|