[mythtv-users] WOL server
Harry Orenstein
holists at verizon.net
Mon Apr 26 00:16:06 UTC 2010
On Sunday 25 April 2010 12:50:16 pm Josu Lazkano wrote:
> Hello, I want to config MythTV with a DVB-S2 tunner. I have a question:
>
> Is it possible to wake up the PC from a WOL server?
>
> The idea is: Shedule a recording, send to a WOL server the time of the
> recording, and then the server will wake up the MythTV PC two-five
> minutes before the recording.
>
> I have a OpenWRT based router that will be the perfect WOL server for that.
>
> Thanks for all and regards.
I did this for a while. Still do occasionally. Here are the scripts I used:
Myth scripts to send the wakeup message (the second is optional):
mythwakeup:
----------
#!/bin/sh
if [ "$1" = "" ]; then
wakeup=`date -d '11am tomorrow' +%s`
else
wakeup=$1
fi
echo $wakeup > /tmp/mythwakeup.txt
echo "shutdown from mythtv will wake up at `epoch2date $wakeup`" >>
/var/log/mythtv/mythwakeup.log
scp -q /tmp/mythwakeup.txt root at 10.0.0.1:/tmp/wakeup.txt
-----------
epoch2date:
-----------
#!/usr/bin/env perl
#perl -le 'print scalar localtime $1'
$secs = $ARGV[0];
print scalar localtime $secs;
print "\n";
-----------
OpenWRT script to check for the wakeup:
-----------
now11=`date "+%Y%m%d%H%M"`
echo "checking for wake up at $now11" > /tmp/wakeup.log
now11=`date "+%s"`
if [ ! -f /tmp/wakeup.txt ]
then
exit
fi
read wakeupat < /tmp/wakeup.txt
if [ "$wakeupat" -lt "$now11" ]
then
/usr/bin/wol -p 65535 -h 10.0.0.255 00:00:00:00:00:00
rm /tmp/wakeup.txt
echo "woke up mythtv" >> /tmp/wakeup.log
fi
------------
Change the ethernet addresses to match your network and you also have to set
up ssh via a key (no password). I ran the first to set up the wakeup and the
last was set up to run every 10 minutes on the router using cron. You also
need to add the following to your /etc/init.d/halt to enable WOL:
/sbin/ethtool -s eth0 wol g
HTH!
-- Harry O.
More information about the mythtv-users
mailing list