[mythtv-users] E-mail notices on HDPVR crap-out?

freedenizen freedenizen at gmail.com
Fri Jul 30 13:40:44 UTC 2010


On Thu, Jul 29, 2010 at 5:40 PM, steve <networks1 at cox.net> wrote:
> Greetings.  I’ve got my MythTV set up with a Hauppauge HDPVR.  It
> periodically craps-out and needs to be restarted.  Yesterday I missed some
> recordings I really wanted before I discovered it had crashed.   So I’m
> wondering if there’s any way to notify myself when this happens.  I’m pretty
> sure there’s nothing built in to MythTV for this purpose, so I’m wondering
> if I might be able to write an external app to check it periodically--or to
> check with MythTV--to see if it’s operational and, say, send myself an email
> if it’s not.  Any ideas appreciated.

It is a super hack job and could really be cleaned up, but here is my
script, I found I have to hard boot the hdpvrs twice to get it to
work, which is what the iboot.pl script does:

#!/bin/bash
logerror=`grep 'Recorder Failed' /var/log/mythbackend.log | tail -1`
if [ "$logerror" ]
then
   md5=`echo $logerror | md5sum `
   md5=`expr "$md5" : '\([0-9a-z]\+\)'`
   previous=`cat /var/tmp/pvr-fail-previous | grep $md5`

   SUBJECT="HDPVR FAILURE"
   EMAILADDRESS="[YOUR_EMAIL_ADDRESS_HERE]"
   EMAILCONTENT="/tmp/emailmessage.txt"
   echo "HDPVR Recorder Failed: $logerror ">$EMAILCONTENT
   if [ "$md5" != "$previous" ]
   then
        /bin/mail -s "$SUBJECT" "$EMAILADDRESS" < $EMAILCONTENT
        rmmod hdpvr lirc_zilog lirc_dev
        /usr/local/bin/iboot.pl
        sleep 25
        modprobe hdpvr lirc_zilog
        /usr/local/bin/iboot.pl
        sleep 25
        /etc/init.d/mythbackend restart
   fi

   echo $md5 > /var/tmp/pvr-fail-previous
fi


More information about the mythtv-users mailing list