[mythtv-users] frontend freeze causing backend live tv recording flag problems

John Taylor john at vetsurgeon.org.uk
Wed Oct 31 17:10:13 UTC 2007


Many thanks for the all the help on this. On the basis of this, I have
cobbled together a few scripts that
- enable the use of the red button on my streamzap remote to restart X
- calculate the last time a button was pressed on the remote and if
more that 90 minutes has elapsed will simulate an ESCAPE and stop live
tv to reduce the chance of my frontend crashing
- monitors mythfrontend CPU usage and CPU temp and restarts X if > 90% / 90 C

just put scripts in root tftp directory and minimyth.script will download them

John

minimyth.script:
mkdir /var/spool
mkdir /var/spool/cron
mkdir /var/spool/cron/crontabs
tftp 192.168.27.10 -g -r minimyth.cron -l /var/spool/cron/crontabs/minimyth
crond

tftp 192.168.27.10 -g -r ct -l /home/minimyth/ct
chmod +x /home/minimyth/ct
tftp 192.168.27.10 -g -r mythpowerbutton.sh -l /home/minimyth/mythpowerbutton.sh
chmod +x /home/minimyth/mythpowerbutton.sh
tftp 192.168.27.10 -g -r checklastbuttonpress -l
/home/minimyth/checklastbuttonpress
chmod +x /home/minimyth/checklastbuttonpress
tftp 192.168.27.10 -g -r buttonpress -l /home/minimyth/buttonpress
chmod +x /home/minimyth/buttonpress


-----------------------------------------------------------------------------------------------------------------------------
relevant part of lircrc:
begin
   prog = irexec
   button = POWER
   repeat = 10
   config = /home/minimyth/mythpowerbutton.sh
end

begin
   prog = irexec
   button = *
   repeat = 10
   config = /home/minimyth/buttonpress
end

-----------------------------------------------------------------------------------------------------------------------------
ct (monitors cpu usage/ mythfrontend)
#!/bin/sh
MFC=`top -n 1 | grep mythfrontend | awk {' if ( $6 > 90 ) print 1'}`
#change 90 to whatever
MFT=`sensors | grep "CPU Temp" | awk {' if ( $3 > 90 ) print 1'}` #
change 90 to whatever
if [ "$MFT" -eq "1" ]
then
echo 'MYTHFRONTEND restart due to temp more than 90' >>/home/minimyth/messages
/home/minimyth/mythpowerbutton.sh #

elif [ "$MFC" -eq "1" ]
then
echo 'MYTHFRONTEND restart due to cpu % more than 90' >>/home/minimyth/messages
/home/minimyth/mythpowerbutton.sh

else
echo `date` CPU Temp `sensors | grep "CPU Temp" | awk {' print $3
'}`C, Mythfrontend CPU `top -n 1 | grep mythfrontend | awk {' print $6
'}`'%' >>/home/minimyth/messages

fi

-----------------------------------------------------------------------------------------------------------------------------
mythpowerbutton.sh (restarts X)
#!/bin/sh
killall mythfrontend

wait
echo `date` "SYSTEM RESTARTED" >> /home/minimyth/messages
/etc/rc.d/init.d/x start

-----------------------------------------------------------------------------------------------------------------------------
buttonpress (logs when any remote control button is pressed):
#!/bin/sh
echo `date +%s` > /home/minimyth/lastpress

-----------------------------------------------------------------------------------------------------------------------------
checklastbuttonpress (run by cron to calculate when last button pressed)
#!/bin/sh
LP=`cat /home/minimyth/lastpress`
NW=`date +%s`
DIFF=`echo $LP $NW | awk {'print $2-$1'}`
echo `date` 'check last button push:' $DIFF ' seconds'>>/home/minimyth/messages
if [ $DIFF -gt 5400 ] #can change 5400 to however many seconds required
then
echo "key escape" | nc 192.168.27.11 6546
echo `date` 'Escape key simulated'>>/home/minimyth/messages
fi
-----------------------------------------------------------------------------------------------------------------------------
minimyth.cron:
11 * * * * /home/minimyth/ct
*/10 * * * * /home/minimyth/checklastbuttonpress




On 10/30/07, John Taylor <john at vetsurgeon.org.uk> wrote:
> Hi
>
> Can anyone help!?
>
> John
>
> On 10/18/07, John Taylor <john at vetsurgeon.org.uk> wrote:
> > Running mythtv 0.20.20070821-1 on Ubuntu desktop kernel
> > 2.6.20-16-generic with 1 Nova T DVB tuner PCI card. Also have an Epia
> > M diskless frontend running minimyth
> >
> > Having a slight problem with overheating in the frontend system
> > causing the box to freeze occasionally. A quick reboot fixes it.
> >
> > My problem is then I am unable to watch live tv on the same rebooted
> > frontend. The backend reports:
> > "MythTV is already using all the available inputs for the channel you
> > selected..."
> >
> > If I then try to delete the current Live TV show being recorded from
> > the Media Library I get:
> > "This recording is currently in use by : [name of the backend
> > server](Recording)"
> >
> > I assume the backend assigns the live tv to the frontend system and
> > sets a flag preventing anyone else interfering with this (good!)
> >
> > When the frontend crashes, is the flag not being cleared to allow the
> > frontend to watch live tv again?
> >
> > If not, how can I clear the flag without restarting the backend?
> >
> > Thanks
> >
> > John
> >
>


More information about the mythtv-users mailing list