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

Last change on this file since 7115 was 7106, 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
29source /home/operator/Mars/datacenter/scripts/sourcefile
30
31cd $mars
32date=`date +%F`
33
34subsystemdir=/magic/subsystemdata
35filesondisklogpath=$logpath/filesondisk/`date +%Y`
36
37if [ ! -d $filesondisklogpath ]
38then
39 mkdir -pv $filesondisklogpath
40 if [ ! -d $filesondisklogpath ]
41 then
42 echo "could not make directory "$filesondisklogpath
43 exit
44 fi
45fi
46
47
48
49echo "checking disk for ccfiles..."
50
51filename=$filesondisklogpath/ccfilesondisk-$date.txt
52column=fCCFileAvail
53
54find $subsystemdir/cc/ -name '*_S.rep' | cut -d_ -f2 > $filename
55
56
57echo "resetting runs..."
58check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
59
60case $check3 in
61 1) echo "check3=$check3 -> everthing ok -> reset is done";;
62 *) echo "check3=$check3 -> ERROR -> something went wrong while resetting";;
63esac
64
65
66
67echo "checking disk for cacofiles..."
68
69filename=$filesondisklogpath/cacofilesondisk-$date.txt
70column=fCaCoFileAvail
71
72find $subsystemdir/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
73
74
75echo "resetting runs..."
76check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
77
78case $check0 in
79 1) echo "check0=$check0 -> everthing ok -> reset is done";;
80 *) echo "check0=$check0 -> ERROR -> something went wrong while resetting";;
81esac
82
83
84
85echo "checking missing cacofiles..."
86check1=`root -q -b $macrospath/findcacofiles.C+\("\"$date\""\) | tee $filesondisklogpath/findcacofiles-$date.log | grep int | sed -e 's/(int)//'`
87
88case $check1 in
89 1) echo "check1=$check1 -> everthing ok -> missing cacofiles are found";;
90 *) echo "check1=$check1 -> ERROR -> something went wrong while resetting";;
91esac
92
93missingcacoruns=(`cat $filesondisklogpath/findcacofiles-$date.txt`)
94
95for missingcacorun in ${missingcacoruns[@]}
96do
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
129done
130
131
132
133echo "checking disk for rawfiles..."
134
135filename=$filesondisklogpath/rawfilesondisk-$date.txt
136column=fRawFileAvail
137
138find $datapath -name '*.raw' | cut -d_ -f2 > $filename
139
140echo "resetting runs..."
141check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$date.log | grep int | sed -e 's/(int)//'`
142
143case $check4 in
144 1) echo "check4=$check4 -> everthing ok -> reset is done";;
145 *) echo "check4=$check4 -> ERROR -> something went wrong while resetting";;
146esac
147
148
Note: See TracBrowser for help on using the repository browser.