View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 18 posts ] 
Go to page 1, 2  Next

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Wake On Lan Trick
PostPosted: Wed Aug 02, 2006 7:27 am 
Offline
Joined: Sun May 30, 2004 11:05 am
Posts: 37
Location: Acton, Ontario, Canada
Hey folks,

Love the Cesman...love Knoppmyth...life is great.

I live in Toronto, Canada. Power here is starting to cost one a small fortune. Large, noisy PC's running as master backends consuming 300 watts from the wall ain't no way to save the planet. I needed a better solution.

Here was the goal:

1) create a master backend using all my cheapo unused hardware and a hauppauge card (PVR250).

2) have the master backend autoshutdown after 7 minutes of inactivity (i.e. no commercial flagging, no transcoding, no SMB shares active, etc.)

3) have the master backend send out a "wake up call" to another listening computer on my LAN and then shut down the master backend.

4) use another MUCH lower power box on 24/7 to receive the "wake up call" via inet or xinet daemon and schedule a wake up job via Wake On Lan.

5) have SSH secure login available from the internet on the 24/7 box to allow me to wake the master backend from "anywhere" with internet service so that I could use MythWeb and mythstreamtv, etc.

I'd installed KnoppMyth R5C7 with no issues. I'd configured a couple of scripts on another MUCH lower power box running *nix (another flavor) with a power conditioning, low power UPS (software controlled).

The scripts were working. The wake up call was issued to the 24/7 box showing the date and time of the next wake cycle. The 24/7 box was issuing the command to Wake On Lan to the master backend...nothing.

For all you green kiddies out there trying to get the shutdown/wakeup thingy going...Cecil (KnoppMyth GOD) has graciously provided ALL the tools you need to have a master backend shutdown on a time out and then get set up to Wake On Lan (if your mobo is capable).

I was pulling my hair out for a long time with a Piece of Quaif EliteGroup mobo with a Via chipset. Turns out the "canned" driver settings for the Via Rhine networking has Wake On Lan 'disabled' by default.

The trick is to re-enable it during the boot sequence. In some past posts, cesman elected to include an app called 'ethtool' in the current build. Brilliant!!!

First you can use the tool to see if your chipset supports wake on lan by various methods (i.e. blanket packet, targeted packet, etc. -- google 'wake on lan'). Fire up a terminal and:

Code:
$ /usr/bin/ethtool eth0    <----or whatever your ethernet port is numbered

You will get some feedback on the type of WOL supported AND if WOL is enabled...if the wake on lan shows that type 'g' is supported but it is 'd' disabled, you will have to force it on.

Essentially, during the move in runlevel 5 in the latter stages of startup, you can lob in the command:

/usr/bin/ethtool -s eth0 wol g

I just dropped this into the /home/mythtv/.fluxbox/apps

[startup] {/usr/bin/ethtool -s eth0 wol g}

Now it all works perfectly, thank you very much.

I like this arrangement much better than the nvram wakeup. I'm not really a fan of BIOS tweaks like this and the 24/7 box allows me to securely wake my master backend via an SSH portal, rather than a broadcast packet of the MAC address over the internet to the neighbourhood port on my router/NATS box on 192.168.*.255 port 9.

Once the backend is up, I can do my business, log out and the backend will shut itself off in 7 minutes after I've logged out. Sweet.

This arrangement can be done on a Linksys NSLU2, Xbox running linux, laptop, WRAP board using m0n0wall, Mini-itx platform -- virtually anything that you can plug linux into that uses less than 50 watts (i.e. one light bulb) is, as Martha says, 'a good thing'.

Squiff


Top
 Profile  
 
PostPosted: Thu Aug 10, 2006 9:51 am 
Offline
Joined: Mon Feb 20, 2006 8:32 am
Posts: 27
squiffy,

Thanks for the good info! I am interesting in doing something like this as well.

So the WOL funtion will turn the back-end on as soon as a machine pings/requests something from the Back-end IP address??

Where can I get the tools to enable this auto-shutdown after 7 mins?

Thanks

_________________
-hunter


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 5:48 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
The way WOL works is that any system with the software to do so can wake another system up over the LAN by sending a "magic packet". All the tools are already included.

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject: WOL Tricks
PostPosted: Thu Aug 10, 2006 8:21 pm 
Offline
Joined: Sun May 30, 2004 11:05 am
Posts: 37
Location: Acton, Ontario, Canada
cesman wrote:
The way WOL works is that any system with the software to do so can wake another system up over the LAN by sending a "magic packet". All the tools are already included.


Hunter:

Cesman [the KnoppMyth creator if I'm not mistaken] has already included the wake on lan tool I described in my initial post. I use it as a "workaround" for the Via Rhine driver module that does not set wake on lan enabled by default.

The developers over at MythTV have provided all the tools and configuration to set up the master backend to shutdown.

If you follow this link:

http://www.mythtv.org/docs/mythtv-HOWTO-11.html

And go to near the bottom of the page to the section 11.5 Shutdown/Wake Up...it'll walk you through the pieces to set up the backend to shutdown.

Warning, Will Robinson...you MUST have a 24/7 uptime box somewhere that can receive a wake up call and then send out a wake on lan package.

I use a repaired (i.e. free when I got it) Xbox running X-Damn Small Linux. It is running 'inetd' and I've apt-get'd 'etherwake' and 'wakeonlan' perl stuff.

Effectively, the arrangement works this way...

1) The KnoppMyth master backend runs through a series of checks to see if it is truly IDLE;

2) If this list comes back all true, then an 'exit 0' condition exists and IF it has counted out its 7 minutes (my choice...you can use more or less), it is ready to shutdown;

3) The backend uses 'netcat' to broadcast a wake up time bundle using a standard POSIX format (read that link above) and issues it's wake up call to my Linux Xbox;

4) The Xbox receives the wake up call time via a TCP packet and runs a script to post an "at" job into the 'at' job queue;

5) At the appointed time, the Xbox runs a script that includes a 'wakeonlan' perl script call with the MAC address of my backend -- this occurs about 4 minutes prior to the scheduled event to allow for boot time delays (your choice for more or less);

6) The scheduled event occurs -- go to 1) above, lather, rinse, repeat.

Works great.

The scripts shown in the link above won't work as written on X-DSL linux on the Xbox. You can replace all the for/do loop quaif in the script with

Code:
atrm -a


this should clear the at job queue and allow posting a single instance...essential for the functionality to work correctly.

I prefer this wake up method, since I can also use the magic packet WOL trick to wake the backend from anywhere I have an internet connection and a SSH client (since I run sshd on my Xbox) and then use MythWeb and MythStreamTV to have some remote fun on company time.

Having written all this up now, I suppose I should do a little wikifying to show the method in case any others wanna do this and avoid paying Big Brother power company mondo bucks for server juice.

Squiff

PS good luck...PM me if you want scripts, etc.


Top
 Profile  
 
PostPosted: Fri Aug 11, 2006 9:45 am 
Offline
Joined: Mon Feb 20, 2006 8:32 am
Posts: 27
Squiff,

Did you look into the Nvram-Wakeup functions that are in Knoppmyth? I just read about them here:

http://www.knoppmythwiki.org/index.php? ... upToRecord

This uses a BIOS timer to wake up the Backend PC a few minutes before a Recording.

I have to see if my motherboard supports NVRam-Wakeup. There is a way to find out(from the link above):

"How To Do It

1. apt-get install nvram-wakeup

2. Run nvram-wakeup with no parameters and see if your motherboard is supported. If it isn't (mine wasn't), look at the man pages (or just start guess-helper)... there's still hope. I recommend taking a look at the man pages anyway. HEED ALL THE WARNINGS!

2a. Add the following lines to lilo.conf (don't forget to run lilo after):

image=/boot/vmlinuz-2.6.9-3
label=PowerOff
read-only
append="0"

"

_________________
-hunter


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 11, 2006 5:03 pm 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
WOL has the benefit (in the case where you have the other hardware to support it) that you can manually boot your backend remotely. With the nvram-wakeup stuff, you are basically screwed if you want to use your box remotely and it happens to be off. What would be awesome is if the wakeup call thing could be suported by the router rather than needing another box running.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 11, 2006 5:26 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
It should not matter if your backend is set via nvram-wakeup. You should still be able to wake it using WOL. As far as I'm aware, the two aren't mutually exclusion. If one has a router with a firmware that can be change to something more open, one probably could use it to wake a backend.

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 12, 2006 6:23 am 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
cesman wrote:
If one has a router with a firmware that can be changed to something more open, one probably could use it to wake a backend.
That was kind of what I was thinking. Anyone know of such a router? I have a crappy D-Link DSL-302G, so I dont think I'll have any luck there.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 6:16 am 
Offline
Joined: Sun May 30, 2004 11:05 am
Posts: 37
Location: Acton, Ontario, Canada
Gang,

I choose to WOL over nvram-wakeup since I am a hardware guy and I really don't like the idea of writing to BIOS to set a wakeup time...a lot of stuff I read about dynamic writes to BIOS indicates that you can end up with an expensive (and sexy IMHO) toaster if you don't get it right.

A few of the BIOS'es out there have some issues with DSDT (google that) that can get one into some trouble, quicksand like...same outcome, problems.

For me, WOL is a known commodity that works well.

Greg Frost wrote:
WOL has the benefit (in the case where you have the other hardware to support it) that you can manually boot your backend remotely. With the nvram-wakeup stuff, you are basically screwed if you want to use your box remotely and it happens to be off. What would be awesome is if the wakeup call thing could be suported by the router rather than needing another box running.


I couldn't agree more. Part of my consideration was power saving and having access to my MP3 library, which is housed on a TSOP flashed Xbox running a legal BIOS (Cromwell) and Xbox ported Damn Small Linux running server side perl software. That's another story though...

Cesman wrote:
It should not matter if your backend is set via nvram-wakeup. You should still be able to wake it using WOL. As far as I'm aware, the two aren't mutually exclusion.


That's right on too. The tools are present in the base install of KnoppMyth for doing all the Wake On Lan stuff. The nvram stuff apt-get's nice too.

Lastly,

Cesman wrote:
If one has a router with a firmware that can be changed to something more open, one probably could use it to wake a backend.


There's a couple out there that will allow this to occur. You could go the route of a NAS box (like a Linksys NSLU2 or a Buffalo Linkstation) and use that product's embedded Linux to do some neat stuff.

The NSLU2 linux project has an open source firmware and a project page. Some genius over there even create a package system mimicking dpkg called ipkg that will download many packages a la apt-get.

The advantage to something like this is you can share files via SaMBa and use it as the repository for files.

If you are looking into open source routers, the one to go with is the Linksys WRT54GL -- take careful note of the 'L' on the end. Visit the Linksys main site and they will give fanfare to the open source router in lieu of VxWorks based ones.

You can hack that one to your heart's delight...has wireless and is a relative bargain (I think under $100). You can then use this box that draws less than 5 watts from the wall to act as your "wake up call" box like I use my Xbox...

I just get lots of geek factor out of my DMCA legal Xbox :-)

All up gang, they're your boxes, your environment, your power company and ISP...your choice...that's the beauty of *nix and MythTV.

Squiffy

Sergeant Hartmann: Ahhhhh!!!! That's a warface...you don't scare me, work on it.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 6:43 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
never played with open router firmware, but this one will do it....WRT54GL

http://www.amazon.com/gp/product/B000BTL0OA/104-1725810-1374332?n=172282

Image

$60 - $10 rebate = $50

The 'L' at the end of the model number is for 'Linux'

All of the old linksys routers were linux based and re-flashable. this newest version V5 is VMWARE based and will not take the open source firmware. After much gripe from the OS community, they released the 'L' version to allow OS flashing. you can also search around for a pre V5 model..ebay, electronic stores with little traffic... you'll need to check the serial numbers to deterime the verison.

If intrested in more detail about the WRT54G versions/SNs and what OS firmware is compatible for each version ...check here http://en.wikipedia.org/wiki/WRT54G

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 12:47 pm 
Offline
Joined: Sat Jan 07, 2006 7:21 pm
Posts: 24
I have an old dell running pfsense as my router with freeBSD (IIRC). The web interface already supports WOL so I assume that it wouldn't take too much work. What would be really slick is to some how add a nat rule of some sort that automagically sends the WOL packet if the host is unreachable :) . Not positive how doable this would be in the long run though.


Top
 Profile  
 
 Post subject: ohh-kay
PostPosted: Tue Aug 29, 2006 6:36 pm 
Offline
Joined: Sun May 30, 2004 11:05 am
Posts: 37
Location: Acton, Ontario, Canada
tuckie wrote:
I have an old dell running pfsense as my router with freeBSD (IIRC). The web interface already supports WOL so I assume that it wouldn't take too much work. What would be really slick is to some how add a nat rule of some sort that automagically sends the WOL packet if the host is unreachable :) . Not positive how doable this would be in the long run though.


Tuckie,

Not sure where you're going with this.

Query: do you keep your MythTV backend "up" 100% of the time?

By a NAT rule, are you talking some kind of Network Address Translation thingy or a pfsense version of 'at' such that you can use the scripted backend shutdown to send a wake up call?

Just wondering really.

Ultimately, I think I'll go the route of the Linksys box, since they're relatively cheap, hackable (i.e. infinitely configurable) and does all the needed functions at a fraction of the power consumption of my Xbox running linux.

Alternatively, I'd consider a laptop that can be used to run as a slave backend/frontend with the wakeonlan bit, a Plextor MPEG4 capture USB box, network connection 100% and the netcat stuff to maintain all things healthy.

Must sleep now...


Top
 Profile  
 
 Post subject: WOL on a Dragon
PostPosted: Tue Oct 24, 2006 10:49 am 
Offline
Joined: Tue Dec 13, 2005 3:13 pm
Posts: 43
Location: Leicestershire, UK
Will this work with a box that is both a frontend and backend? or will the fact that the front end is always connected prevent it from going idle?

I would be happy if I could just shutdown normally and let the WOL function wake it up again when necessary.

Using Dragon hardware, so should be able to support WOL.

Algenon.

_________________
Dragon without HDTV card, PVR350, PAL-UK


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 24, 2006 2:06 pm 
Offline
Site Admin
Joined: Fri Sep 19, 2003 6:37 pm
Posts: 2657
Location: Whittier, Ca
Instead of starting the frontend, start mythwelcome. Just edit /usr/local/bin/KnoppMyth-run and change the appropriate line.


Top
 Profile  
 
PostPosted: Thu Nov 02, 2006 4:42 pm 
Offline
Joined: Tue Dec 13, 2005 3:13 pm
Posts: 43
Location: Leicestershire, UK
I have been trying to implement the WOL function, but can't even get the 24/7 server to recognise the message from my frontend/backend machine. I am trying to use the scripts at http://mythtv.org/docs/mythtv-HOWTO-11.html#ss11.5 which suggest editing the /etc/inetd.conf and /etc/services file on the 24/7 machine and use the following script.
Code:
#! /bin/bash
#this should be a command to wake your server
WAKECMD="#!/bin/sh\n /usr/local/bin/wakeMBE"
#first we need to delete all wake jobs in queue
for JOB in atq | cut -f 1 ; do
    atrm $JOB;
done
#now we read the date from 'nc'
read date;
#now set the atjob
echo -e "$WAKECMD" | at $date ;


I can't get any of this to work, I am wondering if anyone else has got WOL to work?

I accept that this is not strictly KnoppMyth stuff but any help would be appreciated.

Regards,

Algenon.

_________________
Dragon without HDTV card, PVR350, PAL-UK


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 
Go to page 1, 2  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu