[mythtv-users] Slave backend (only) WOL

Aaaaaaaron pixilated8 at comcast.net
Fri Apr 20 14:45:42 UTC 2007


David Brodbeck wrote:
> David Muench wrote:
>   
>> On 2/17/07, David Brodbeck <gull at gull.us> wrote:
>>   
>>     
>>> I have a master backend/frontend, and a slave backend.  I'd like to have
>>> the master backend wake the slave when it's needed to avoid conflicts
>>> and shut it down when it's not, but I *don't* want the master backend to
>>> ever shut itself down.  I'm having a little trouble figuring out the
>>> right combination of settings to accomplish this.  Currently the master
>>> backend lists the slave as "not connected" when it's shut down, and
>>> never wakes it up.  When it's up, it also never shuts it down.
>>>     
>>>       
>> Did you ever get anywhere with this? I started thinking about this
>> last night myself and am starting to research it..
>>   
>>     
>
> Nope.  I concluded the code probably didn't support it.  I've just been
> leaving the slave on 24/7.  The power draw isn't that much, less than 60
> watts when the machine is idle, so this costs me less than $50 per year.
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
>
>   
I have a very old K6-2 that I use for a mbe.  My slave is a newer 
machine with a pair of PVR-150's.  After scouring the net and using 
others hard work, this is what I've cobbled together to get my slave to 
wake up.  It's not pretty or elegant, but it seems to get the job done.

I have a cron job that runs at 20 and 50 minutes past the hour (so 10 
minutes before the top and bottom of the hour, which seems reasonable, 
unless I've set up a new recording within that ten minute window).  It 
examines what shows are to be recorded next, and sets an "at" job to run 
a wakeonlan at 5 minutes before the recording starts.  I don't have any 
automated shutdown script for the slave yet, but this at least ensures 
that my slave is ready to record when it needs to.

------------------------------

mythtv at mbe ~ $ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXX9BdkOR installed on Sat Apr  7 11:04:23 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie 
Exp $)
20,50 * * * * /home/mythtv/schedcheck

------------------------------

mythtv at mbe ~ $ cat schedcheck
#!/bin/bash

# Save the status file in the temp directory:
wget http://localhost:6544 -O /tmp/mythstatus.html -q

# Get next recording time and cleanup the time file:
NEXTRECORDING=`cat /tmp/mythstatus.html | awk '/<a href="#">/{print 
substr($0,19);exit}' | cut -d "-" -f 1`
rm /tmp/mythstatus.html
#echo ${NEXTRECORDING}

# Next recording time, in number of seconds since 1970 01/01:
NEXTRECORDINGSEC=`date -d "${NEXTRECORDING}" +%s`
#echo ${NEXTRECORDINGSEC}

# Subtract five minutes
MINUS5=$((${NEXTRECORDINGSEC} - 5 * 60))
#echo ${MINUS5}

# Convert the seconds to something that "at" can use
WAKEUP=`date -d "1970-01-01 ${MINUS5} sec GMT" "+%H:%M %b %e %Y"`
#echo ${WAKEUP}

# Check existing queue
QUEUE=`atq`
QJOB=`echo "${QUEUE}"|cut -f 1`
ATDATE=`echo "${QUEUE}"|cut -f 2|cut -d " " -f 1-2`
#echo ${QUEUE}
#echo ${QJOB}
#echo ${ATDATE}

QDATE=`date -d "${ATDATE}" "+%H:%M %b %e %Y"`
#echo ${QDATE}

if [ "${QDATE}" != "${WAKEUP}" ]; then
  # Queue it
  atrm ${QJOB}
  at "${WAKEUP}" -f /home/mythtv/wakeslave
fi

------------------------------

mythtv at mbe ~ $ cat wakeslave
#!/bin/sh

wakeonlan -f /home/mythtv/recorder.mac

------------------------------

mythtv at mbe ~ $ cat recorder.mac
00:11:22:33:44:55




More information about the mythtv-users mailing list