| 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-2004
|
|---|
| 23 | #
|
|---|
| 24 | #
|
|---|
| 25 | # ========================================================================
|
|---|
| 26 | #
|
|---|
| 27 | #
|
|---|
| 28 |
|
|---|
| 29 | source /home/operator/Mars/datacenter/scripts/sourcefile
|
|---|
| 30 |
|
|---|
| 31 | cd $mars
|
|---|
| 32 | date=`date +%F`
|
|---|
| 33 |
|
|---|
| 34 | subsystemdir=/magic/subsystemdata
|
|---|
| 35 | filesondisklogpath=$logpath/filesondisk/`date +%Y`
|
|---|
| 36 |
|
|---|
| 37 | if [ ! -d $filesondisklogpath ]
|
|---|
| 38 | then
|
|---|
| 39 | mkdir -pv $filesondisklogpath
|
|---|
| 40 | if [ ! -d $filesondisklogpath ]
|
|---|
| 41 | then
|
|---|
| 42 | echo "could not make directory "$filesondisklogpath
|
|---|
| 43 | exit
|
|---|
| 44 | fi
|
|---|
| 45 | fi
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | echo "checking disk for ccfiles..."
|
|---|
| 50 |
|
|---|
| 51 | filename=$filesondisklogpath/ccfilesondisk-$date.txt
|
|---|
| 52 | column=fCCFileAvail
|
|---|
| 53 |
|
|---|
| 54 | find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | echo "resetting runs..."
|
|---|
| 58 | check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
|---|
| 59 |
|
|---|
| 60 | case $check3 in
|
|---|
| 61 | 1) echo "check3=$check3 -> everthing ok -> reset is done";;
|
|---|
| 62 | *) echo "check3=$check3 -> ERROR -> something went wrong while resetting";;
|
|---|
| 63 | esac
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 | echo "checking disk for cacofiles..."
|
|---|
| 68 |
|
|---|
| 69 | filename=$filesondisklogpath/cacofilesondisk-$date.txt
|
|---|
| 70 | column=fCaCoFileAvail
|
|---|
| 71 |
|
|---|
| 72 | find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | echo "resetting runs..."
|
|---|
| 76 | check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
|---|
| 77 |
|
|---|
| 78 | case $check0 in
|
|---|
| 79 | 1) echo "check0=$check0 -> everthing ok -> reset is done";;
|
|---|
| 80 | *) echo "check0=$check0 -> ERROR -> something went wrong while resetting";;
|
|---|
| 81 | esac
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | echo "checking missing cacofiles..."
|
|---|
| 86 | check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\) | tee $filesondisklogpath/findcacofiles-$date.log | grep int | sed -e 's/(int)//'`
|
|---|
| 87 |
|
|---|
| 88 | case $check1 in
|
|---|
| 89 | 1) echo "check1=$check1 -> everthing ok -> missing cacofiles are found";;
|
|---|
| 90 | *) echo "check1=$check1 -> ERROR -> something went wrong while resetting";;
|
|---|
| 91 | esac
|
|---|
| 92 |
|
|---|
| 93 | missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
|
|---|
| 94 |
|
|---|
| 95 | for missingcacorun in ${missingcacoruns[@]}
|
|---|
| 96 | do
|
|---|
| 97 | runno=$missingcacorun
|
|---|
| 98 | echo "no cacofile found for run "$runno
|
|---|
| 99 | echo "finding cacofile"
|
|---|
| 100 | ccfile=`find $subsystemdir/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
|
|---|
| 101 | echo "ccfile: "$ccfile
|
|---|
| 102 | if [ "$ccfile" = "" ]
|
|---|
| 103 | then
|
|---|
| 104 | echo "no ccfile found for run "$runno
|
|---|
| 105 | continue
|
|---|
| 106 | fi
|
|---|
| 107 | for (( i = 0; i <= 10; i++ ))
|
|---|
| 108 | do
|
|---|
| 109 | newrun=`echo $runno - $i | bc`
|
|---|
| 110 | path=`dirname $ccfile`
|
|---|
| 111 | path=`echo $path | sed -e 's/cc/caco/'`
|
|---|
| 112 | cacofile=`find $path -name *$newrun*`
|
|---|
| 113 | if [ "$cacofile" = "" ]
|
|---|
| 114 | then
|
|---|
| 115 | continue
|
|---|
| 116 | else
|
|---|
| 117 | echo "inserting cacofile $file for run $missingcacorun..."
|
|---|
| 118 | check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $filesondisklogpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
|
|---|
| 119 |
|
|---|
| 120 | case $check2 in
|
|---|
| 121 | 1) echo "check2=$check2 -> everthing ok -> insert is done";;
|
|---|
| 122 | *) echo "check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun;;
|
|---|
| 123 | esac
|
|---|
| 124 | break
|
|---|
| 125 | fi
|
|---|
| 126 | done
|
|---|
| 127 | echo "cacofile: "$cacofile
|
|---|
| 128 |
|
|---|
| 129 | done
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 | echo "checking disk for rawfiles..."
|
|---|
| 134 |
|
|---|
| 135 | filename=$filesondisklogpath/rawfilesondisk-$date.txt
|
|---|
| 136 | column=fRawFileAvail
|
|---|
| 137 |
|
|---|
| 138 | find $datapath -name '*.raw' | cut -d_ -f2 > $filename
|
|---|
| 139 |
|
|---|
| 140 | echo "resetting runs..."
|
|---|
| 141 | check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
|
|---|
| 142 |
|
|---|
| 143 | case $check4 in
|
|---|
| 144 | 1) echo "check4=$check4 -> everthing ok -> reset is done";;
|
|---|
| 145 | *) echo "check4=$check4 -> ERROR -> something went wrong while resetting";;
|
|---|
| 146 | esac
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|