Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: sp8870 firmware crash - monitor to reload drivers



David Thompson wrote:
...
Would like to run some sort of a script that monitors
the syslog for the message ie ..

Jan 29 19:18:06 linux kernel: sp8870_set_frontend:
firmware crash!!!!!!

And when this happens then runs another script that
kills vdr and reloads drivers and firmware.

Can anyone tell me how best to do this?
There are many ways to do that.

Doesnt your VDR exit anyway after the firmware crashes?
If yes, all you have to do is to unload and reload the
driver modules in your runvdr script.
If no, have you experimented with lower watchdog timeouts?
You can also use the VDR -s option to make VDR shutdown
regularly when it has been idle for a while.

Just as an example, here is my runvdr script, which even
reboots the machine when it detects certain messages in
the log:


-----------------------------------------------------------------------------------------------------------
#!/bin/sh -x

VDRUSER=cko
VDRDIR=/home/cko/VDR
CONFIGDIR=/home/cko/vdrconfig
TOOLDIR=/home/cko/bin
VDRCMD="$VDRDIR/vdr -c $CONFIGDIR  -P osdteletext -P burn  -s $TOOLDIR/killvdr"
LOG=/var/log/update_timers_log
INTERVAL=60

/bin/setserial  /dev/ttyS0 uart none
modprobe lirc_serial
/usr/sbin/lircd
ulimit -c unlimited
LD_ASSUME_KERNEL=2.4.1;export LD_ASSUME_KERNEL

mount -av
cd $VDRDIR

find /video -follow -name 'noad.pid' -exec rm '{}' \;
su -c "allnewnoad nice /video" $VDRUSER &

while (true) do
   $TOOLDIR/killvdr
   rmmod budget budget_core dvb_ttpci ttpci_eeprom saa7146_vv saa7146 ves1x93 stv0299 l64781 ves1820 tda8083 stv0297 sp8870 i2c_nforce2 i2c_core dvb_core firmware_class video_buf v4l2_common v4l1_compat videodev

# if the last timer update was more than $INTERVAL minutes ago...
   if [ "`find $LOG -mmin -$INTERVAL`" != $LOG ] ; then
# ...and if we are connected to the internet anyway...
      connected=`ssh duron /usr/sbin/isdnctrl status isdn0 |cut -c-15`
      if [ "$connected" == "isdn0 connected" ] ; then
         date >> $LOG
         $TOOLDIR/update_timers >> $LOG 1>&2
         echo >> $LOG
      fi
   fi

   chmod +r /var/log/messages

   /usr/sbin/ntpdate duron

   modprobe dvb_ttpci vidmode=2
   modprobe budget

   su -c "$VDRCMD" $VDRUSER

   tail -200 /var/log/messages > /tmp/tail_messages
   if  fgrep -q 'emergency exit' /tmp/tail_messages            || \
       fgrep -q 'nobody cared' /tmp/tail_messages              || \
       fgrep -q 'page allocation failure' /tmp/tail_messages   || \
       fgrep -q 'no OSD provider available' /tmp/tail_messages || \
       fgrep -qi 'error' /tmp/tail_messages || \
       fgrep -q ' kernel:  [<' /tmp/tail_messages
   then
      Mail -s "VDR problem." cko@icem.de < /tmp/tail_messages
      /usr/sbin/ntpdate duron
      /sbin/hwclock --systohc
      sleep 2
      sync
      init 6
      sync
      exit 0
   fi

   if [ `date +%H` -ge 04 ] && [ `date +%H` -le 05 ] ; then
      /usr/sbin/ntpdate duron
      /sbin/hwclock --systohc
      sync
      init 6
      sync
      exit 0
   fi

done
-----------------------------------------------------------------------------------------------------------





Here is the killvdr script it uses:

-----------------------------------------------------------------------------------------------------------
#!/bin/sh
fuser -k -TERM /dev/dvb/*/* > /dev/null
sleep 3
fuser -k -KILL /dev/dvb/*/* > /dev/null
-----------------------------------------------------------------------------------------------------------




Home | Main Index | Thread Index