| 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 | # Author(s): Stefan Ruegamer 08/2007 <mailto:snruegam@astro.uni-wuerzburg.de>
|
|---|
| 22 | #
|
|---|
| 23 | # Copyright: MAGIC Software Development, 2000-2007
|
|---|
| 24 | #
|
|---|
| 25 | #
|
|---|
| 26 | # ========================================================================
|
|---|
| 27 | #
|
|---|
| 28 | # This script is launching star for sequences.
|
|---|
| 29 | #
|
|---|
| 30 | # As star takes some time, only one sequence is processed at once.
|
|---|
| 31 | # First the script gets a sequence number from the database for which
|
|---|
| 32 | # star has to be done (function gettodo). After setting the status in the
|
|---|
| 33 | # database (set fStartTime; to know that the sequence is already being
|
|---|
| 34 | # processed), the image parameters are calculated for the sequence.
|
|---|
| 35 | # Afterwards the status in the database is updated according to the return
|
|---|
| 36 | # value of star.
|
|---|
| 37 | # The important INFOs, WARNings and ERRORs are written not only to the
|
|---|
| 38 | # scriptlog but also to the processlog.
|
|---|
| 39 | #
|
|---|
| 40 | # The star.rc files are taken from the datacenter/setup/star directory
|
|---|
| 41 | #
|
|---|
| 42 |
|
|---|
| 43 | source `dirname $0`/sourcefile
|
|---|
| 44 | printprocesslog "INFO starting $0"
|
|---|
| 45 | program=star
|
|---|
| 46 | column=fStar
|
|---|
| 47 |
|
|---|
| 48 | set -C
|
|---|
| 49 |
|
|---|
| 50 | scriptlog=$runlogpath/run$program-$datetime.log
|
|---|
| 51 | date >> $scriptlog 2>&1
|
|---|
| 52 |
|
|---|
| 53 | # get sequence #
|
|---|
| 54 | gettodo >> $scriptlog 2>&1
|
|---|
| 55 | sequence=$process
|
|---|
| 56 |
|
|---|
| 57 | # lock sequ
|
|---|
| 58 | lockfile=$lockpath/lock-$table-$column-$sequence.txt
|
|---|
| 59 | checklock >> $scriptlog 2>&1
|
|---|
| 60 |
|
|---|
| 61 | cd $mars
|
|---|
| 62 |
|
|---|
| 63 | echo "run $program for sequence $sequence..." >> $scriptlog 2>&1
|
|---|
| 64 | printprocesslog "INFO starting $program for sequence $sequence"
|
|---|
| 65 | no=`printf %08d $sequence | cut -c 0-4`
|
|---|
| 66 | no2=`printf %08d $sequence`
|
|---|
| 67 | outpath="$datapath/$program/$no/$no2"
|
|---|
| 68 | inpath=`echo $outpath | sed -e 's/star/callisto/'`
|
|---|
| 69 | makedir $outpath >> $scriptlog 2>&1
|
|---|
| 70 |
|
|---|
| 71 | sequfile="$sequpath/$no/sequence$no2.txt"
|
|---|
| 72 |
|
|---|
| 73 | primvar=$no2
|
|---|
| 74 | setstatus "start" >> $scriptlog 2>&1
|
|---|
| 75 |
|
|---|
| 76 | echo "staging files..." >> $scriptlog 2>&1
|
|---|
| 77 | ssh -nx phoenix /opt/SUNWsamfs/bin/stage -V $inpath/20*_0*${run}_Y_*_E.root >> $scriptlog 2>&1
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | # define star.rc files
|
|---|
| 81 | starrcnew=$setuppath/$program/star.rc
|
|---|
| 82 | starrcmux=$setuppath/$program/star_mux.rc
|
|---|
| 83 | # link star.rc file
|
|---|
| 84 | echo "linking the star.rc file to $outpath" >> $scriptlog 2>&1
|
|---|
| 85 | if [ $sequence -gt 200000 ]
|
|---|
| 86 | then
|
|---|
| 87 | ln -vsf $starrcmux $outpath/star.rc >> $scriptlog 2>&1
|
|---|
| 88 | else
|
|---|
| 89 | ln -vsf $starrcnew $outpath/star.rc >> $scriptlog 2>&1
|
|---|
| 90 | fi
|
|---|
| 91 | starrcseq=$outpath/star.rc
|
|---|
| 92 |
|
|---|
| 93 | echo "./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile --config=$starrcseq 2>> $scriptlog> /dev/null" >> $scriptlog 2>&1
|
|---|
| 94 | ./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile --config=$starrcseq 2>> $scriptlog> /dev/null
|
|---|
| 95 | check1=$?
|
|---|
| 96 |
|
|---|
| 97 | case $check1 in
|
|---|
| 98 | 0) echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
|
|---|
| 99 | printprocesslog "INFO $program finished successfully for sequence $sequence"
|
|---|
| 100 | ;;
|
|---|
| 101 | *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
|---|
| 102 | printprocesslog "ERROR $program failed for sequence $sequence"
|
|---|
| 103 | com=$Fstar
|
|---|
| 104 | check=$check1
|
|---|
| 105 | ;;
|
|---|
| 106 | esac
|
|---|
| 107 |
|
|---|
| 108 | setstatus "stop" >> $scriptlog 2>&1
|
|---|
| 109 |
|
|---|
| 110 | finish >> $scriptlog 2>&1
|
|---|
| 111 |
|
|---|