Index: trunk/DataCheck/Monitoring/CheckLogs.sh
===================================================================
--- trunk/DataCheck/Monitoring/CheckLogs.sh	(revision 18693)
+++ trunk/DataCheck/Monitoring/CheckLogs.sh	(revision 18702)
@@ -6,34 +6,51 @@
 
 source `dirname $0`/../Sourcefile.sh
-printprocesslog "INFO starting $0"
+printprocesslog "INFO starting $0 $1"
 
-lasthour=`date +'%F %H' --date="-1hour"`
-
-processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log
-
-if grep -E "^$lasthour.*WARN" $processlogfile >/dev/null
+if ! [ "$1" = "day" ] && ! [ "$1" = "hour" ]
 then 
-   grep -E "^$lasthour.*WARN" $processlogfile | mail -s 'found warnings in '$processlogfile $erradrs
-   printprocesslog "INFO sent warnings to "$erradrs
+   #echo "wrong option "$1" (only min and nights valid)."
+   echo "wrong option "$1" (only day and hour valid)."
+   finish
 fi
 
-if grep -E "^$lasthour.*ERROR" $processlogfile >/dev/null
+# check for connection problems or full disks every hour
+if [ "$1" = "hour" ]
 then 
-   grep -E "^$lasthour.*ERROR" $processlogfile | mail -s 'found errors in '$processlogfile $erradrs
-   printprocesslog "INFO sent errors to "$erradrs
+   lastdate=`date +'%F %H' --date="-1hour"`
+   processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log
+   
+   if grep -E "^$lastdate.*DISK" $processlogfile >/dev/null
+   then 
+      grep -E "^$lastdate.*DISK" $processlogfile | mail -s 'disk full ('$processlogfile')' $deladrs
+      printprocesslog "INFO sent full-disk info to "$deladrs
+   fi
+
+   if grep -E "^$lastdate.*CONNECTION" $processlogfile >/dev/null
+   then
+      grep -E "^$lastdate.*CONNECTION" $processlogfile | mail -s 'found connection problems found ('$processlogfile')' $erradrs
+      printprocesslog "INFO sent connection-problem info to "$erradrs
+   fi
 fi
 
-if grep -E "^$lasthour.*CONNECTION" $processlogfile >/dev/null
-then 
-   grep -E "^$lasthour.*CONNECTION" $processlogfile | mail -s 'found connection problems found ('$processlogfile')' $erradrs
-   printprocesslog "INFO sent connection-problem info to "$erradrs
+# check for errors and warnings once a day
+if [ "$1" = "day" ]
+then
+   lastdate=`date +'%F ' --date="-1hour"`
+   processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log
+   
+   if grep -E "^$lastdate.*WARN" $processlogfile >/dev/null
+   then
+      grep -E "^$lastdate.*WARN" $processlogfile | mail -s 'found warnings in '$processlogfile $erradrs
+      printprocesslog "INFO sent warnings to "$erradrs
+   fi
+
+   if grep -E "^$lastdate.*ERROR" $processlogfile >/dev/null
+   then
+      grep -E "^$lastdate.*ERROR" $processlogfile | mail -s 'found errors in '$processlogfile $erradrs
+      printprocesslog "INFO sent errors to "$erradrs
+   fi
 fi
 
-if grep -E "^$lasthour.*DISK" $processlogfile >/dev/null
-then 
-   grep -E "^$lasthour.*DISK" $processlogfile | mail -s 'disk full ('$processlogfile')' $deladrs
-   printprocesslog "INFO sent full-disk info to "$deladrs
-fi
+printprocesslog "INFO finished $0 $1"
 
-printprocesslog "INFO finished $0"
-
