source: trunk/MagicSoft/Mars/datacenter/scripts/filesondisk@ 6934

Last change on this file since 6934 was 6934, checked in by Daniela Dorner, 20 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.5 KB
Line 
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
29export ROOTSYS=/opt/root_v3.10.02
30export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
31export PATH=$PATH:$ROOTSYS/bin
32
33mars=/home/operator/Mars
34macrospath=$mars/datacenter/macros
35
36cd $mars
37date=`date +%F`
38
39subsystemdir=/magic/subsystemdata
40rawdir=/magic/data
41logpath=/magic/datacenter/autologs/filesondisk/`date +%Y`
42
43if [ ! -d $logpath ]
44then
45 mkdir -pv $logpath
46 if [ ! -d $logpath ]
47 then
48 echo "could not make directory "$logpath
49 exit
50 fi
51fi
52
53
54
55echo "checking disk for ccfiles..."
56
57filename=$logpath/ccfilesondisk-$date.txt
58column=fCCFileAvail
59
60find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename
61
62
63echo "resetting runs..."
64check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $logpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
65
66case $check3 in
67 1) echo "check3=$check3 -> everthing ok -> reset is done";;
68 *) echo "check3=$check3 -> ERROR -> something went wrong while resetting";;
69esac
70
71
72
73echo "checking disk for cacofiles..."
74
75filename=$logpath/cacofilesondisk-$date.txt
76column=fCaCoFileAvail
77
78find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
79
80
81echo "resetting runs..."
82check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $logpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
83
84case $check0 in
85 1) echo "check0=$check0 -> everthing ok -> reset is done";;
86 *) echo "check0=$check0 -> ERROR -> something went wrong while resetting";;
87esac
88
89
90
91echo "checking missing cacofiles..."
92check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\) | tee $logpath/findcacofiles-$date.log | grep int | sed -e 's/(int)//'`
93
94case $check1 in
95 1) echo "check1=$check1 -> everthing ok -> missing cacofiles are found";;
96 *) echo "check1=$check1 -> ERROR -> something went wrong while resetting";;
97esac
98
99missingcacoruns=(`cat $logpath/findcacofiles-$date.txt`)
100
101for missingcacorun in ${missingcacoruns[@]}
102do
103 runno=$missingcacorun
104 echo "no cacofile found for run "$runno
105 echo "finding cacofile"
106 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`
107 echo "ccfile: "$ccfile
108 if [ "$ccfile" = "" ]
109 then
110 echo "no ccfile found for run "$runno
111 continue
112 fi
113 for (( i = 0; i <= 10; i++ ))
114 do
115 newrun=`echo $runno - $i | bc`
116 path=`dirname $ccfile`
117 path=`echo $path | sed -e 's/cc/caco/'`
118 cacofile=`find $path -name *$newrun*`
119 if [ "$cacofile" = "" ]
120 then
121 continue
122 else
123 echo "inserting cacofile $file for run $missingcacorun..."
124 check2=`root -q -b $macrospath/insertcacofile.C+\("\"$runno\""\,"\"$newrun\""\) | tee $logpath/insertcacofile-$missingcacorun.log | grep int | sed -e 's/(int)//'`
125
126 case $check2 in
127 1) echo "check2=$check2 -> everthing ok -> insert is done";;
128 *) echo "check2=$check2 -> ERROR -> something went wrong while inserting run "$missingcacorun;;
129 esac
130 break
131 fi
132 done
133 echo "cacofile: "$cacofile
134
135done
136
137
138
139echo "checking disk for rawfiles..."
140
141filename=$logpath/rawfilesondisk-$date.txt
142column=fRawFileAvail
143
144find $rawdir -name '*.raw' | cut -d_ -f2 > $filename
145
146echo "resetting runs..."
147check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $logpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
148
149case $check4 in
150 1) echo "check4=$check4 -> everthing ok -> reset is done";;
151 *) echo "check4=$check4 -> ERROR -> something went wrong while resetting";;
152esac
153
154
Note: See TracBrowser for help on using the repository browser.