| 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 star for sequences.
|
|---|
| 28 | #
|
|---|
| 29 | # As star takes some time, only one sequence is processed at once.
|
|---|
| 30 | # First the script gets a sequence number from the database, for which
|
|---|
| 31 | # star has to be done (function gettodo). After setting the status in the
|
|---|
| 32 | # database (set fStartTime to know, that the sequence is already being
|
|---|
| 33 | # processed), the image parameters are calculated for the sequence.
|
|---|
| 34 | # Afterwards the status in the database is updated according to the return
|
|---|
| 35 | # value of star.
|
|---|
| 36 | # The important INFOs, WARNings and ERRORs are written not only to the
|
|---|
| 37 | # scriptlog but also to the processlog.
|
|---|
| 38 | #
|
|---|
| 39 | # The star.rc file is taken from the Mars directory.
|
|---|
| 40 | #
|
|---|
| 41 |
|
|---|
| 42 | source `dirname $0`/sourcefile
|
|---|
| 43 | printprocesslog "INFO starting $0"
|
|---|
| 44 | program=star
|
|---|
| 45 | column=fStar
|
|---|
| 46 |
|
|---|
| 47 | set -C
|
|---|
| 48 |
|
|---|
| 49 | scriptlog=$runlogpath/run$program-$datetime.log
|
|---|
| 50 | date >> $scriptlog 2>&1
|
|---|
| 51 |
|
|---|
| 52 | # get sequence #
|
|---|
| 53 | gettodo >> $scriptlog 2>&1
|
|---|
| 54 | sequence=$process
|
|---|
| 55 |
|
|---|
| 56 | # lock sequ
|
|---|
| 57 | lockfile=$lockpath/lock-$table-$column-$sequence.txt
|
|---|
| 58 | checklock >> $scriptlog 2>&1
|
|---|
| 59 |
|
|---|
| 60 | cd $mars
|
|---|
| 61 |
|
|---|
| 62 | echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
|
|---|
| 63 | printprocesslog "INFO starting $program for sequence $sequence"
|
|---|
| 64 | no=`printf %08d $sequence | cut -c 0-4`
|
|---|
| 65 | no2=`printf %08d $sequence`
|
|---|
| 66 | outpath="$datapath/$program/$no/$no2"
|
|---|
| 67 | inpath=`echo $outpath | sed -e 's/star/callisto/'`
|
|---|
| 68 | makedir $outpath >> $scriptlog 2>&1
|
|---|
| 69 |
|
|---|
| 70 | sequfile="$sequpath/$no/sequence$no2.txt"
|
|---|
| 71 |
|
|---|
| 72 | primvar=$no2
|
|---|
| 73 | setstatus "start" >> $scriptlog 2>&1
|
|---|
| 74 |
|
|---|
| 75 | ssh pegasus /opt/SUNWsamfs/bin/stage $inpath/*_Y_*.root &
|
|---|
| 76 |
|
|---|
| 77 | echo "./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
|
|---|
| 78 | ./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile 2>> $scriptlog> /dev/null
|
|---|
| 79 | check1=$?
|
|---|
| 80 |
|
|---|
| 81 | case $check1 in
|
|---|
| 82 | 0) echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
|
|---|
| 83 | printprocesslog "INFO $program finished successfully for sequence $sequence"
|
|---|
| 84 | ;;
|
|---|
| 85 | *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
|---|
| 86 | printprocesslog "ERROR $program failed for sequence $sequence"
|
|---|
| 87 | com=$Fstar
|
|---|
| 88 | check=$check1
|
|---|
| 89 | ;;
|
|---|
| 90 | esac
|
|---|
| 91 |
|
|---|
| 92 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 93 |
|
|---|
| 94 | finish >> $scriptlog 2>&1
|
|---|
| 95 |
|
|---|