| 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 links a special callisto.rc for data, for which the
|
|---|
| 28 | # calibration with the standard callisto.rc failes.
|
|---|
| 29 | #
|
|---|
| 30 | # The sequences with failing calibration are searched by searching for the
|
|---|
| 31 | # reason of failure in the callisto.log Then the special callisto.rc is
|
|---|
| 32 | # linked to the directory of the sequence.
|
|---|
| 33 | #
|
|---|
| 34 |
|
|---|
| 35 | user=`whoami`
|
|---|
| 36 | source /home/$user/Mars/datacenter/scripts/sourcefile
|
|---|
| 37 |
|
|---|
| 38 | set -C
|
|---|
| 39 |
|
|---|
| 40 | callistorcseq=callisto.rc
|
|---|
| 41 | callistorcnew=callisto_Dec04Jan05.rc
|
|---|
| 42 |
|
|---|
| 43 | scriptlogpath=$logpath/run/makecallistolinks/`date +%Y/%m/%d`
|
|---|
| 44 | makedir $scriptlogpath
|
|---|
| 45 | scriptlog=$scriptlogpath/makingcallistolinks`date +%F`.log
|
|---|
| 46 |
|
|---|
| 47 | date >> $scriptlog 2>&1
|
|---|
| 48 |
|
|---|
| 49 | # check if script is already running
|
|---|
| 50 | lockfile=$lockpath/lock-making-callisto-links.txt
|
|---|
| 51 | date > $lockfile >> $scriptlog 2>&1
|
|---|
| 52 | checklock0=$?
|
|---|
| 53 | case $checklock0 in
|
|---|
| 54 | 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
|
|---|
| 55 | 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
|
|---|
| 56 | echo "-> makecallistolinks is running -> exit" >> $scriptlog 2>&1
|
|---|
| 57 | date >> $scriptlog 2>&1
|
|---|
| 58 | exit;;
|
|---|
| 59 | *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
|
|---|
| 60 | esac
|
|---|
| 61 |
|
|---|
| 62 | # reason why calibration with standard callisto.rc fails
|
|---|
| 63 | reason="Pulse is too much to the right, cannot go beyond logain limits!"
|
|---|
| 64 | echo "reason: "$reason >> $scriptlog 2>&1
|
|---|
| 65 |
|
|---|
| 66 | # find files containing reason
|
|---|
| 67 | files=`find $datapath/callisto -name callisto*.log`
|
|---|
| 68 |
|
|---|
| 69 | # make links for callisto.rc for which the callisto.log contains reason
|
|---|
| 70 | for file in $files
|
|---|
| 71 | do
|
|---|
| 72 | pulse=`cat $file | grep "$reason"` >> $scriptlog 2>&1
|
|---|
| 73 | if [ ! "$pulse" = "" ]
|
|---|
| 74 | then
|
|---|
| 75 | path=`dirname $file` >> $scriptlog 2>&1
|
|---|
| 76 | ln -vfs $setuppath/callisto/$callistorcnew $path/$callistorcseq >> $scriptlog 2>&1
|
|---|
| 77 | fi
|
|---|
| 78 | done
|
|---|
| 79 |
|
|---|
| 80 | rm -v $lockfile >> $scriptlog 2>&1
|
|---|
| 81 |
|
|---|
| 82 | set +C
|
|---|
| 83 |
|
|---|
| 84 | date >> $scriptlog 2>&1
|
|---|
| 85 |
|
|---|