Mailing List archive

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

[vdr] Workaround for UPT Errors



Hi everybody,

I got so annoyed by the "unknown picture type" error (occured a lot
here lately), that I wrote some little shell-script which worked fine
here. Thought I'd share this with you.

It's nothing fancy, suggestions for improvement are welcome, you might
need to adjust some things for your distribution, anyway, here we go:

/etc/crontab:

# alle 1 Min. UPT prüfen
*/1  * * * *   root    /usr/local/bin/wache


/usr/local/bin/wache:

#!/bin/sh

CFG=/etc/vdr/wache
LOG=/var/log/syslog
DFORM="+%Y%m%d%H%M"

if test -f $CFG; then 
   LASTDONE=`tail -n 1 $CFG`
else
   LASTDONE=`date $DFORM -d -1year`
   echo $LASTDONE >>$CFG
fi

if grep "ERROR: unknown picture type" $LOG >/dev/null 2>&1; then
   LASTUPT=`grep "ERROR: unknown picture type" $LOG 2>/dev/null | \
   tail -n 1 | cut -d ' ' -f 1-3`
   LASTUPT=`date $DFORM -d "$LASTUPT"`
   diff=`echo "$LASTUPT - $LASTDONE" | bc`
   if test $diff -ge 0;then
      NOW=`date $DFORM`
      echo $NOW >>$CFG
      echo "Argl! Reset"
      echo LASTUPT in Log: $LASTUPT
      echo LASTDONE by wache: $LASTDONE
      /usr/local/bin/vdrreset
   fi
fi


/usr/local/bin/vdrreset:

#!/bin/sh

echo -n "killing runvdr ... "
killall -9 runvdr && sleep 1
echo "done"
echo -n "killing vdr ... "
killall -9 vdr && sleep 5
echo "done"
echo "make rmmod;sleep 1;start runvdr"
cd /usr/local/src/DVB/driver;make rmmod
sleep 1s
/usr/local/src/VDR/runvdr &


As I said: it's nothing fancy, but might prove to be useful for some
of you. What it basically does: it checks /var/syslog for UPT-Errors
and compares the last occurence to the last reset of VDR. The first
time "wache" is called, it resets the VDR (may need improvement).

Oh, it relies on "bc", because the shell was not able to process huge
integer-numbers (timestamps) like 200312251734.


HTH  Frederick



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index