Sunday, December 04, 2005

Save power.

One thing that I noticed in the installation of 0.18.1 of MythTV is that the detection of whether the computer was started automatically or not no longer worked for me. I used to have this script fire up the frontend for me:

mythtv@mythtv ~ $ cat /usr/local/bin/mythguictrl

use warnings;
use strict;

package main;

my $lockfile ='/home/mythtv/.mythguilock';
my $logfile ='/home/mythtv/.mythtv/guilocklog';

my $date =`/usr/bin/date`;

-e $lockfile and unlink $lockfile;

if( $ARGV[0] eq "auto" ){

open LOCK,'>',$lockfile;
print LOCK "1";
close LOCK;


open(STARTLOG,">> $logfile ") or die "Unable to open log file:$!";
print STARTLOG "$ARGV[0] $date";


This script is iserted as a startup script of MythTV. If the computer was started up automatically, for instance using nwram-startup, it is supplied the argument 'auto', the frontend was not started, and the box would shut down itself after recording was done.

Now, after 0.18.1, this did not work anymore, so we started using more power than necessary since the box would fire up, record and then be on for the rest of the day. Not good.

An alternative solution was posted by Phill Edwards here

mythtv@mythtv ~ $ cat /home/mythtv/bin/
# This script checks whether any keys have been pressed on the remote control
# in the TIMEOUT seconds since mythfrontend was started (this script is started
# when mythfrontend is from .ratpoisonrc). If there has been any presses then
# the frontend is assumed to be in use and so we don't want to shutdown
# mythfrontend. If there haven't been any key presses then assume that it's not
# in use so we kill mythfrontend (which is auto started on system startup) so
# that the auto shutdown processing can then go ahead.

#15 minutes

irw > $LOGF &
sleep $TIMEOUT

IRLOG=`cat $LOGF | wc -l | awk '{print $1}'`
#UNK=`cat $LOGF | grep unknown | grep -v grep | wc -l | awk '{print $1}'`

#if [ $IRLOG -eq 0 ] || [ $IRLOG == $UNK ]

if [ $IRLOG -eq 0 ]
echo " killing mythfrontend at `date`" >> /tmp/mythrestart.log
killall $PROG

exit 0

This script will shut down the frontend after 20 minutes if no button on the remote control has been pressed before this time. Since human use of MythTV requires at least one menu change, this will prevent it from shuting down the box in case you acctually wanted to use it from the frontend. Inventive work-around.


Blogger dwainclinton5948 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. My blog is just about my day to day life, as a park ranger. So please Click Here To Read My Blog

11:12 pm  
Blogger joewilliams6667 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. So please Click Here To Read My Blog

9:24 am  

Post a Comment

Links to this post:

Create a Link

<< Home