| 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 12/2005 <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 | scriptlogpath=$logpath/run/processmcsequences/`date +%Y/%m/%d`
|
|---|
| 35 | makedir $scriptlogpath
|
|---|
| 36 | scriptlog=$scriptlogpath/processmcsequences`date +%F-%H-%M-%S`.log
|
|---|
| 37 |
|
|---|
| 38 | date >> $scriptlog 2>&1
|
|---|
| 39 |
|
|---|
| 40 | lockfile=$lockpath/lock-processmcsequences.txt
|
|---|
| 41 | date > $lockfile >> $scriptlog 2>&1
|
|---|
| 42 | checklock0=$?
|
|---|
| 43 | case $checklock0 in
|
|---|
| 44 | 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
|
|---|
| 45 | 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
|
|---|
| 46 | echo "-> linkmc is running -> exit" >> $scriptlog 2>&1
|
|---|
| 47 | date >> $scriptlog 2>&1
|
|---|
| 48 | exit;;
|
|---|
| 49 | *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
|
|---|
| 50 | esac
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 | mcpath=/montecarlo/rawfiles
|
|---|
| 54 | mccalpath=/montecarlo/callisto
|
|---|
| 55 | mcimgpath=/montecarlo/star
|
|---|
| 56 | mcsequpath=/montecarlo/sequences
|
|---|
| 57 | callistorc=$setuppath/callisto/callisto.rc
|
|---|
| 58 |
|
|---|
| 59 | sequfiles=`find $mcsequpath -type f`
|
|---|
| 60 |
|
|---|
| 61 | cd $mars
|
|---|
| 62 |
|
|---|
| 63 | for sequfile in ${sequfiles[@]}
|
|---|
| 64 | do
|
|---|
| 65 | sequno=`echo $sequfile | cut -c 36-43`
|
|---|
| 66 | no=`echo $sequno | cut -c 0-4`
|
|---|
| 67 | date=`grep Night $sequfile | cut -c 18-29 | sed -e 's/-/\//g'`
|
|---|
| 68 | caloutpath=$mccalpath/$no/$sequno
|
|---|
| 69 | makedir $caloutpath >> $scriptlog 2>&1
|
|---|
| 70 |
|
|---|
| 71 | if ls $caloutpath/.done >> $scriptlog 2>&1
|
|---|
| 72 | then
|
|---|
| 73 | continue
|
|---|
| 74 | fi
|
|---|
| 75 |
|
|---|
| 76 | if ls $caloutpath/.doing >> $scriptlog 2>&1
|
|---|
| 77 | then
|
|---|
| 78 | continue
|
|---|
| 79 | fi
|
|---|
| 80 |
|
|---|
| 81 | touch $caloutpath/.doing
|
|---|
| 82 |
|
|---|
| 83 | echo "processing sequ $sequfile" >> $scriptlog 2>&1
|
|---|
| 84 |
|
|---|
| 85 | if [ -e $caloutpath/callisto.rc ]
|
|---|
| 86 | then
|
|---|
| 87 | echo "found callisto.rc in $caloutpath -> using this " >> $scriptlog 2>&1
|
|---|
| 88 | callistorcseq=$caloutpath/callisto.rc
|
|---|
| 89 | else
|
|---|
| 90 | echo "no callisto.rc found in $caloutpath -> making link " >> $scriptlog 2>&1
|
|---|
| 91 | ln -vs $callistorc $caloutpath/callisto.rc >> $scriptlog 2>&1
|
|---|
| 92 | callistorcseq=$caloutpath/callisto.rc
|
|---|
| 93 | fi
|
|---|
| 94 |
|
|---|
| 95 | echo "./callisto -mc -f -b -q --ind=$mcpath/$date --log=$caloutpath/callisto$sequno.log --html=$caloutpath/callisto$sequno.html --out=$caloutpath --config=$callistorcseq $sequfile 2>> $scriptlog > /dev/null" >> $scriptlog 2>&1
|
|---|
| 96 | ./callisto -mc -f -b -q --ind=$mcpath/$date --log=$caloutpath/callisto$sequno.log --html=$caloutpath/callisto$sequno.html --out=$caloutpath --config=$callistorcseq $sequfile 2>> $scriptlog > /dev/null
|
|---|
| 97 | check1=$?
|
|---|
| 98 |
|
|---|
| 99 | case $check1 in
|
|---|
| 100 | 0) echo "check1=$check1 -> everything ok..." >> $scriptlog 2>&1
|
|---|
| 101 | touch $caloutpath/.done
|
|---|
| 102 | rm $caloutpath/.doing
|
|---|
| 103 | imgoutpath=$mccalpath/$no/$sequno
|
|---|
| 104 | makedir $imgoutpath >> $scriptlog 2>&1
|
|---|
| 105 | ./star -b -q -v4 -f -mc --log=$imgoutpath/star$sequno.log --html=$imgoutpath/star$sequno.html --ind=$caloutpath --out=$imgoutpath $sequfile 2>> $scriptlog> /dev/null
|
|---|
| 106 | check2=$?
|
|---|
| 107 |
|
|---|
| 108 | case $check2 in
|
|---|
| 109 | 0) echo "check2=$check2 -> everything ok..." >> $scriptlog 2>&1
|
|---|
| 110 | touch $imgoutpath/.done
|
|---|
| 111 | ;;
|
|---|
| 112 | *) echo "check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
|---|
| 113 | ;;
|
|---|
| 114 | esac
|
|---|
| 115 | ;;
|
|---|
| 116 | *) echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
|
|---|
| 117 | esac
|
|---|
| 118 | done
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 | rm -v $lockfile >> $scriptlog 2>&1
|
|---|
| 122 |
|
|---|
| 123 | set +C
|
|---|
| 124 |
|
|---|
| 125 | date >> $scriptlog 2>&1
|
|---|
| 126 |
|
|---|