[mythtv-users] script to reboot box if ivtv doesn't load correctly

Malcolm mythtv at lds.dyndns.org
Wed Mar 17 11:43:28 EST 2004

Hey Guys,

I know we all run our boxes different for various reasons.  My box reboots
every night at 3:30am so that way it's always nice and strong for the day :)
It seems if I just let it run for days on end within about 3 days myth will
lock and I'll have to reboot.  This always seems to happen right in the
middle of something we're all watching.

Well the reboot was great at first but as I'm sure most of you have
discovered when ivtv loads sometimes it does not load correctly.  Is it the
firmware?  This will result in blank (0 byte) recordings.  Usually it's my
second capture card that doesn't load the firmware correctly and then my
second recordings are all 0 byte files.

So I wrote the attached script which will hopefully help out some others
too.  Basically after you reboot your box it will be executed at boot.
It tries to "cat /dev/video0 > /tmp/test0.mpg" (for each capture card) and
if any of them produce a 0 byte recording it will reboot the box again.  It
also keeps track of the reboots to prevent an endless cycle.  I have the
default set as no more than 3 reboots.  Each time it reboots it also sends
you an email letting you know it had to reboot the box and it attaches it's
own log file showing what the results where of "cat /dev/videoX >
/tmp/testX.mpg" for each card.

It's worked great for me and hopefully will help some others out too.

I put the script in my mythtv home directory /home/mythtv/pvr-check and then
linked it to /etc/rc.d/rc5.d/S91mythtv

If the script determines that each capture card is working then instead of
rebooting it fires up lircd, mythbackend, and starts commercial flagging of
any unflagged shows incase any was running when the box rebooted.  Of course
you can edit to your needs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pvr-check
Type: application/octet-stream
Size: 3115 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20040317/0548f047/pvr-check.obj

More information about the mythtv-users mailing list