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

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