Index: trunk/MagicSoft/Mars/datacenter/scripts/filesondisk
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 8901)
+++ trunk/MagicSoft/Mars/datacenter/scripts/filesondisk	(revision 9008)
@@ -49,5 +49,7 @@
 program=filesondisk
 
+
 set -C
+
 
 scriptlog=$runlogpath/$program-$datetime.log
@@ -63,16 +65,14 @@
 cd $mars
 
+
+# ---------------- check disk for cc-files --------------------
+
 echo "checking disk for ccfiles..."  >> $scriptlog 2>&1
 printprocesslog "INFO checking ccfiles"
 filename=$filesondisklogpath/ccfilesondisk-$datetime.txt
-if ls $filename >/dev/null 2>&1 
-then
-   rm -v $filename >> $scriptlog 2>&1 
-fi
-column=fCCFileAvail
-find $subsystempath/cc/ -name '*_S.rep' | cut -d_ -f2  > $filename
+find $subsystempath/cc/ -regextype posix-egrep -regex "^$subsystempath/cc/20[01][0-9]/[01][0-9]/[0-3][0-9]/20[01][0-9][01][0-9][0-3][0-9]_(M[0-9]_)?[0-9]{5,8}(\.[0-9]{3,5})?_[PCD]_.*.rep$" | grep -E -o "(_M[0-9])?_[0-9]{5,8}(\.[0-9]{3,5})?_" > $filename
 
 echo "resetting runs..." >> $scriptlog 2>&1
-check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | intgrep`
+check3=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"fCCFileAvail\"",kFALSE\) | tee -a $scriptlog | intgrep`
 
 case $check3 in 
@@ -89,17 +89,14 @@
 
 
+# ---------------- check disk for caco-files --------------------
 
 echo "checking disk for cacofiles..."  >> $scriptlog 2>&1 
 printprocesslog "INFO checking cacofiles"
 filename=$filesondisklogpath/cacofilesondisk-$datetime.txt
-if ls $filename >/dev/null 2>&1 
-then
-   rm -v $filename >> $scriptlog 2>&1 
-fi
-column=fCaCoFileAvail
-find $subsystempath/caco/ -name '*.txt' | cut -d_ -f8 | grep [0-9] > $filename
+
+find $subsystempath/caco/ -regextype posix-egrep -regex "^$subsystempath/caco/20[01][0-9]/[01][0-9]/[0-3][0-9]/dc_20[01][0-9]_[01][0-9]_[0-3][0-9]_[012][0-9]_[0-5][0-9]_[0-5][0-9]_[0-9]{5,8}_.*\.txt$" | grep -E -o "(_M[0-9])?_[0-9]{5,8}(\.[0-9]{3,5})?_" > $filename
 
 echo "resetting runs..." >> $scriptlog 2>&1 
-check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | intgrep`
+check0=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"fCaCoFileAvail\"",kFALSE\) | tee -a $scriptlog | intgrep`
 
 case $check0 in 
@@ -115,35 +112,34 @@
 esac
 
-date=`date +%F`
-echo "finding missing cacofiles..." >> $scriptlog 2>&1 
-printprocesslog "INFO checking missing cacofiles"
-check1=`root -q -b $macrospath/findcacofiles.C+ | tee $filesondisklogpath/findcacofiles-$datetime.log | intgrep`
 
-case $check1 in 
-   1)   echo " check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 
-        printprocesslog "INFO missing cacofiles found"
-        ;;
-   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
-        printprocesslog "WARN connection to DB failed"
-        ;;
-   *)   echo " check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
-        printprocesslog "ERROR findcacofiles.C failed"
-        ;;
-esac
+# ---------------- find missing caco-files --------------------
+
+#echo "finding missing cacofiles..." >> $scriptlog 2>&1 
+#printprocesslog "INFO checking missing cacofiles"
+#check1=`root -q -b $macrospath/findcacofiles.C+ | tee -a $scriptlog | intgrep`
+#
+#case $check1 in 
+#   1)   echo " check1=$check1 -> everything ok -> missing cacofiles are found" >> $scriptlog 2>&1 
+#        printprocesslog "INFO missing cacofiles found"
+#        ;;
+#   0)   echo " check1=$check1 -> no connection to db -> continue..." >> $scriptlog 2>&1 
+#        printprocesslog "WARN connection to DB failed"
+#        ;;
+#   *)   echo " check1=$check1 -> ERROR -> something went wrong while resetting" >> $scriptlog 2>&1
+#        printprocesslog "ERROR findcacofiles.C failed"
+#        ;;
+#esac
 
 
+# ---------------- check disk for rawfiles --------------------
 
 echo "checking disk for rawfiles..."  >> $scriptlog 2>&1 
 printprocesslog "INFO checking rawfiles"
 filename=$filesondisklogpath/rawfilesondisk-$datetime.txt
-if ls $filename >/dev/null 2>&1 
-then
-   rm -v $filename >> $scriptlog 2>&1 
-fi
-column=fRawFileAvail
-find $datapath/rawfiles/20[0-1][0-9]/ -name '*.raw' -o -name '*.gz' | cut -d_ -f2 > $filename
+
+find $datapath/rawfiles/20[01][0-9] -regextype posix-egrep -regex "^$datapath/rawfiles/20[01][0-9]/[01][0-9]/[0-3][0-9]/20[01][0-9][01][0-9][0-3][0-9]_(M[0-9]_)?[0-9]{5,8}(\.[0-9]{3,5})?_[PCD]_.*\.raw(\.gz)?$" | grep -E -o "(_M[0-9])?_[0-9]{5,8}(\.[0-9]{3,5})?_" > $filename
 
 echo "resetting runs..." >> $scriptlog 2>&1 
-check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"$column\""\) | tee $filesondisklogpath/resetall-$column-$datetime.log | intgrep`
+check4=`root -q -b $macrospath/resetallruns.C+\("\"$filename\""\,"\"fRawFileAvail\"",kFALSE\) | tee -a $scriptlog | intgrep`
 
 case $check4 in 
@@ -159,4 +155,5 @@
 esac
 
+
+
 finish >> $scriptlog 2>&1
-
