Mailing List archive

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

[vdr] Re: Workaround for UPT Errors



Frederick Page wrote:

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.

hi, well do you need that time resolutiuon ?
i used expr and the time-since-epoch format from date +%s.
this works if you substract as first operation, the logic works with a time delta over which a certain numbers of UPT's will trigger a restart of vdr.

i choose 3 syslog entries (i.e. 3 times the error is repeated in the syslog, this excludes the message "last line repeaded XXX times") over 240 seconds (4 min).
i mention this, since the dc/bc pakage is sometimes hatd to figure out for beginners (i.e. the rpm is namend dc, while you use/mention bc...)

Regards Onno


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



Home | Main Index | Thread Index