Automatic WakeOnLan upon accessing MySql or FileShares

  Thread Rating:
  • 4 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
kricker Offline
Team-XBMC QA Specialist
Posts: 3,450
Joined: Apr 2004
Reputation: 20
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
Senior Member
Posts: 184
Joined: Mar 2012
Reputation: 5
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-Kodi Member
Posts: 3,193
Joined: Jun 2009
Reputation: 39
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-Kodi Wiki Guy
Posts: 21,354
Joined: Jan 2011
Reputation: 276
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 common XBMC words: [[debug log]] = debug log, [[Video library]] = Video library, [[SMB]] = SMB , [[userdata]] = userdata, etc
find quote
t4_ravenbird Online
Senior Member
Posts: 184
Joined: Mar 2012
Reputation: 5
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
t4_ravenbird Online
Senior Member
Posts: 184
Joined: Mar 2012
Reputation: 5
Post: #21
(2012-04-14 20:13)Ned Scott Wrote:  Could something like this be adapted to help spin up drives before accessing them?

Not sure, but I dont think so.

A NAS with slow-starting disks would take a long time to respond to a file-access request coming via a network-protocol (samba/nfs/upnp, whatever..)
I would think what might have to be done is more adjustable timeouts for those protocols, possibly showing a dialogue that XBMC is waiting for response
find quote
xxxnelly Offline
Senior Member
Posts: 193
Joined: Dec 2010
Reputation: 1
Post: #22
Is this going to be committed, i would love to see this in openelec

--
Frontend : OpenELEC PVR runnig on Acer Revo 3700
Backend : Ubuntu 11.10 running with TVHeadend 1 x DVB-T, 1 x Dual DVB-S2
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,450
Joined: Apr 2004
Reputation: 20
Location: Knoxville, TN
Post: #23
(2012-04-14 13:43)da-anda Wrote:  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
1. I think a GUI setting for WOL entries would be nice, but I know there are constant discussions of what should be in the GUI and what shouldn't. Personally I agree with da-anda on this. This is something that is more common place these days with the growing usage of media servers housing content. Is there someone who can add this to the patch?
(2012-04-14 13:43)da-anda Wrote:  
  • add a option/flag to the client configuration to auto-wakeup it on XBMC startup (has been requested in the forums IIRC)
This does happen now with this patch if you have "update library on startup" set.
(2012-04-14 13:43)da-anda Wrote:  
  • 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.
Do you mean client or server? I don't know what this patch currently does in these terms, but it is working fine for me. Is this really needed?
(2012-04-14 13:43)da-anda Wrote:  
  • 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)
I'm not sure about this one. If you want to access something, why get asked a second time?
(2012-04-14 13:43)da-anda Wrote:  
  • 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)
This would be neat, but my server wakes and starts playback within 5 seconds, I don't really need this feature. Maybe other's have really slow waking servers and this would be better suited for them.

I would like to see this get committed soon. First it needs to get polished up then reviewed.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
da-anda Offline
Team-Kodi Member
Posts: 3,193
Joined: Jun 2009
Reputation: 39
Location: germany
Post: #24
(2012-04-18 22:38)kricker Wrote:  
(2012-04-14 13:43)da-anda Wrote:  
  • add a option/flag to the client configuration to auto-wakeup it on XBMC startup (has been requested in the forums IIRC)
This does happen now with this patch if you have "update library on startup" set.
I think it should also work if one is not updating the library on startup, but will need the remote server/nas anyway when XBMC is starting up. But as I said, this should be configurable for each WOL client.
(2012-04-18 22:38)kricker Wrote:  
(2012-04-14 13:43)da-anda Wrote:  
  • 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.
Do you mean client or server? I don't know what this patch currently does in these terms, but it is working fine for me. Is this really needed?
I mean WOL client/target (so your remote server/NAS). I'm not sure if the current "tmout" setting (should btw be renamed to "timeout") already does this - haven't looked at the patch in detail.
(2012-04-18 22:38)kricker Wrote:  
(2012-04-14 13:43)da-anda Wrote:  
  • 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)
I'm not sure about this one. If you want to access something, why get asked a second time?
As said, this should be optional. I could imagine users that not necessarily want to trigger a WOL by accidently hitting play or something.
(2012-04-18 22:38)kricker Wrote:  
(2012-04-14 13:43)da-anda Wrote:  
  • 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)
This would be neat, but my server wakes and starts playback within 5 seconds, I don't really need this feature. Maybe other's have really slow waking servers and this would be better suited for them.
I would need it - my NAS (Thecus) is unfortunately not the fastest to boot and sync the active directory permissions with the DC. Takes up to a minute or more. Never timetracked it, but it feels somewhat sloooow.
(This post was last modified: 2012-04-19 11:26 by da-anda.)
find quote
bibi Offline
Senior Member
Posts: 204
Joined: Sep 2009
Reputation: 0
Smile  RE: Automatic WakeOnLan upon accessing MySql or FileShares
Post: #25
(2012-04-18 22:38)kricker Wrote:  
(2012-04-14 13:43)da-anda Wrote:  
  • add a option/flag to the client configuration to auto-wakeup it on XBMC startup (has been requested in the forums IIRC)
This does happen now with this patch if you have "update library on startup" set.
I think it should also work if one is not update the library on startup, but will need the remote server/nas anyway when XBMC is starting up. But as I said, this should be configurable for each WOL client.
[/quote]

Nice to see someone working on this feature Big GrinBig Grin .
I think an option to wol the server everytime that xbmc client starts or wake-up would be the best solution, cause a lot of people (well, i'll start with me Rofl) dont activate the update of the library on startup.
I know that the scan of the library starts automatically when the client wakes up, so i hope it wouldn't be too hard to implement.

Bibi
(This post was last modified: 2012-04-19 15:59 by bibi.)
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,450
Joined: Apr 2004
Reputation: 20
Location: Knoxville, TN
Post: #26
It looks as if this patch wakes the server when starting XBMC as it is. I turned off the "update library on startup" option and the server still woke when I started XBMC. XBMC must try to locate the sources when it starts, thus this patch then wakes those offline sources.

So it looks like we may need an option to NOT wake the offline servers when XBMC starts up.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
t4_ravenbird Online
Senior Member
Posts: 184
Joined: Mar 2012
Reputation: 5
Post: #27
(2012-04-19 17:07)kricker Wrote:  It looks as if this patch wakes the server when starting XBMC as it is. I turned off the "update library on startup" option and the server still woke when I started XBMC. XBMC must try to locate the sources when it starts, thus this patch then wakes those offline sources.

So it looks like we may need an option to NOT wake the offline servers when XBMC starts up.

Do you have anything else configured into XBMC that could trigger accessing files on your server? I checked it and in my test XBMC is NOT waking the server on startup - I see no attempt by XBMC to locate the paths in 'sources.xml' automatically upon startup.
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,450
Joined: Apr 2004
Reputation: 20
Location: Knoxville, TN
Post: #28
I did have the advanced WOL addon do that, but I have since disabled it. I'll check again to make sure I don't have the old WOL addon still enabled.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
t4_ravenbird Online
Senior Member
Posts: 184
Joined: Mar 2012
Reputation: 5
Post: #29
OK. If the problem remains we should try to track it down. It is not supposed to wake the server until it is accessed.
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,450
Joined: Apr 2004
Reputation: 20
Location: Knoxville, TN
Post: #30
I've gone thru and removed any addon which could cause this. I can repeat it consistently. When I start XBMC my server gets woken up. If I comment out the <onaccesswakeup> from advancedsettings.xml then the server does not get woken up when XBMC starts.


Code:
15:49:36 T:1332  NOTICE:  StorageServer Module loaded RUN
15:49:36 T:1332  NOTICE: StorageClient-0.9.2 Starting server
15:49:36 T:1332  NOTICE: StorageServer-0.9.2 Storage Server starting D:\HTPC\Xbmc\portable_data\userdata\Database\commoncache.db
15:49:38 T:4608   ERROR: CRemoteControl::Connect - failed to connect
15:49:51 T:6080   ERROR: Couldn't connect to \\TOWER\TV, error code 31
15:49:51 T:6080   ERROR: CWINFileSMB: Unable to open file '\' Error '53
15:51:23 T:5040  NOTICE: Storing total System Uptime
15:51:23 T:5040  NOTICE: Saving settings

My guess is it happens right where the log says "Couldn't connect to \\TOWER\TV, error code 31". Why it is trying to connect I do not know. Maybe that is happening because I have the recently added items on my home screen?

Read this before using these builds.
XBMC win32 SVN builds
Changelog
(This post was last modified: 2012-04-19 21:56 by kricker.)
find quote
Post Reply