Problems:
Syslog-ng.conf (part of it):
Apr 2 17:20:00 vdr: [6734] EPGSearch: timer conflict check started Apr 2 17:20:00 vdr: [6718] info: 1 Timer-Konflikt(e)! Erster am 02.04 20:38. Anzeigen? Apr 2 17:20:08 vdr: [6734] EPGSearch: timer conflict check finished
Analysing the log isn't complicated:
#!/bin/bash ######################### ##vdr Timer-conflicts and send mail ##30.03.2010 ######################### LOGDATE=`date '+%Y-%m'` DAY=`date '+%d'` LOGFILE="/syslog/vdr/$LOGDATE/vdr.log.$DAY" LOCKFILE="/tmp/timer_konflikt_$DAY.lock" ACTFILE="/tmp/timer_konflikt.log" DATE=`date '+%A %d. %b %Y %H:%M:%S'` MAILTO="user@example.com" SUBJECT="ALERT vdr Timer-conflict($DATE)" ############################################################### /usr/bin/find /tmp/ -name *timer_konflikt* -mtime +1 -exec rm -f {} \; GREP=`/bin/grep "Timer-Konflikt" $LOGFILE` # wenn grep was gefunden rückgabe = 0 if [ $? == 0 ];then GREP=`/bin/grep "Timer-Konflikt" $LOGFILE | tail -1 | cut -d : -f 5-6` #GREP=`/bin/grep "Timer-Konflikt" $LOGFILE | tail -1 | cut -c 40-120` # check mail already send touch $ACTFILE touch $LOCKFILE echo $GREP > $ACTFILE /usr/bin/diff $ACTFILE $LOCKFILE > /dev/null if [ $? != 0 ];then echo $GREP > $LOCKFILE TEXT="A Conflict in a Timer occured in the logfile.\nPleas check.\n\n" TEXT="$TEXT$GREP" TEXT="$TEXT\n\nhttp://vdr.example.org" TEXT="$TEXT\nhttp://vdr.example.lan\n" TEXT="$TEXT \n\n\n\nYour faithful employee,\n\nyour vdr!" echo -e $TEXT | /usr/bin/mailx -s "$SUBJECT" $MAILTO fi rm -f $ACTFILE