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

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