Automatic WakeOnLan upon accessing MySql or FileShares

  Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Solo0815 Offline
Senior Member
Posts: 295
Joined: Sep 2004
Reputation: 0
Post: #11
We are after "Eden" -> implement it!

there are only 10 sorts of people: those who understand binary and those who don't

ATV2 --- PC Kubuntu 12.10 --- Xbox1 with XBMC4Xbox --- PC Win7 --- Raspberry Pi --- VU+ Duo
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,307
Joined: Apr 2004
Reputation: 16
Location: Knoxville, TN
Post: #12
I find this patch very intriguing. This si something I have been wanting for a very long time. I plan make a build with this patch today and see how it performs.

Can you explain the <tmout>700</tmout> option a bit more? Why would we need to constantly send wake-up packets to the server?

Read this before using these builds.
XBMC win32 SVN builds
Changelog
(This post was last modified: 2012-04-12 19:36 by kricker.)
find quote
t4_ravenbird Online
Member
Posts: 90
Joined: Mar 2012
Reputation: 2
Post: #13
(2012-04-12 19:33)kricker Wrote:  I find this patch very intriguing. This si something I have been wanting for a very long time. I plan make a build with this patch today and see how it performs.

Can you explain the <tmout>700</tmout> option a bit more? Why would we need to constantly send wake-up packets to the server?

Thanks!
The 'timeout' specified does not mean that a new wake-up is done at this interval.
Instead is defines the time (in seconds) of inactivity that should pass before a new wake-up is sent.
So, for as long as files are beeing accessed on the server there will not (ever) be re-sent a wake-up, the wake-up will be done after activity stops and has been idle for the time set in 'tmout'

The idea is that if you have a server that is set to go into suspend-mode after e.g 30 minutes of inactivity then you can setup XBMC to send a new wake-up if XBMC detects that no access has been done towards that server for more than e.g 25 minutes (to make sure we wake it up again)
This new wake-up will not be done just because the timer expires, instead it will be done 'just-in-time' when a file-access is done after the timer has expired.


Hope that makes it clearer?
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,307
Joined: Apr 2004
Reputation: 16
Location: Knoxville, TN
Post: #14
I think so.

I have such a server. After 20 minutes of the all disks being idle, the server goes to sleep.

With this setting then, if the timer expires, the new wake event will be sent when I try to access files from the server again. If I don't access that server again the packet will not be sent.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,307
Joined: Apr 2004
Reputation: 16
Location: Knoxville, TN
Post: #15
So with t4_ravenbird's modified files I created a patch for the current master branch. With my preliminary testing things are looking good. I am not using mySQL, just the default XBMC databases. I let my server fall asleep, then tried to play a file from it. The server woke up and then played back perfectly fine.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,307
Joined: Apr 2004
Reputation: 16
Location: Knoxville, TN
Post: #16
@t4_ravenbird

Could this be extended to also wake the server before a library update is done as well as a clean library request?

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
t4_ravenbird Online
Member
Posts: 90
Joined: Mar 2012
Reputation: 2
Post: #17
(2012-04-12 21:06)kricker Wrote:  ...
With this setting then, if the timer expires, the new wake event will be sent when I try to access files from the server again. If I don't access that server again the packet will not be sent.

Yes. Exactly.

(2012-04-13 20:01)kricker Wrote:  @t4_ravenbird

Could this be extended to also wake the server before a library update is done as well as a clean library request?

As I have imagined it that would be redundant? I would think it should work as it is now, whenever the scanning needs to access the server, the same on-access-wake should kick in ..

*
However, if using MySql, I am afraid there will be more issues. The MySql coding just opens the db-connection and will never detect any broken connection (and since it never tries a re-connect there is no place for me to add a retransmission of the wakeup)
find quote
da-anda Offline
Team-XBMC Member
Posts: 1,389
Joined: Jun 2009
Reputation: 27
Location: germany
Post: #18
IIRC there already is a older ticket in the bugtracker that added WOL support. I posted some additional ideas/concepts there IIRC. As far as I remember I had this ideas back then:
  • WOL is not a geek-only thing nowadays, so add a GUI setting that allows to manage several WOL clients, based on their IP/DNS/UNC or whatever. So that any share defined for one of the configured clients will automatically trigger WOL requests on first access
  • add a option/flag to the client configuration to auto-wakeup it on XBMC startup (has been requested in the forums IIRC)
  • each client should have a "timeout" or "startup delay" configured, so that XBMC knows how long it has to wait to try playback again after first attempt. Maybe this can alternatively be done by just pinging the target for a certain amount of time - no idea.
  • add a dialog if the media is on a WOL device and ask the user if the device should wake up (this might be optional/configurable by device)
  • while waiting for the wakeup, ask the user what he likes to do in the meantime. Like if the media to be played is a movie, ask if one want's to watch f.e. the according trailer (online) while waiting for the device (create a playlist with the trailer and queue the movie). Or not a trailer, but a short trivia about the movie, or music or whatever (maybe have entry points for addons here, like the trailers addon, trivia addon etc)
find quote
Ned Scott Offline
Team-XBMC Wiki Guy
Posts: 11,928
Joined: Jan 2011
Reputation: 131
Location: Arizona, USA
Post: #19
Could something like this be adapted to help spin up drives before accessing them? IIRC, some users have funky NAS devices that don't spin up very fast and something in this transition causes XBMC to either think the file is gone or even crash.

You can make easy links to the XBMC wiki using double brackets around words: [[debug log]] = debug log, [[Add-on:YouTube]] = Add-on:YouTube, [[Adding videos to the library]] = Adding videos to the library, [[userdata]] = userdata, etc
find quote
t4_ravenbird Online
Member
Posts: 90
Joined: Mar 2012
Reputation: 2
Post: #20
(2012-04-14 13:43)da-anda Wrote:  IIRC there already is a older ticket in the bugtracker that added WOL support.

OK. The additions I have made builds on that allready existing wol support in XBMC. It is not a duplicate implementation but more in line with some of the additonal ideas you mention
find quote
Post Reply