Automatic WakeOnLan upon accessing MySql or FileShares

  Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
D-an-W Offline
Senior Member
Posts: 163
Joined: Dec 2011
Reputation: 2
Post: #541
I have WOL working ok with my NAS (Synology DS215j), the only issue seems to be the time it waits for the NAS to wake which seems to be just over two minutes from fully off.

I tried the settings below thinking Kodi would wait four minutes in total but it still starts without fully waiting and because of that doesn't show my shares.

Code:
<onaccesswakeup>
    <netinittimeout>20</netinittimeout>
    <netsettletime>500</netsettletime>
    <wakeup>
        <host>XXX.XXX.XXX.XXX</host>
        <mac>00:11:22:33:44:55</mac>
        <pingport>0</pingport>
        <pingmode>0</pingmode>
        <timeout>300</timeout>
        <waitonline>120</waitonline>
        <waitonline2>120</waitonline2>
        <waitservices>5</waitservices>
    </wakeup>
</onaccesswakeup>

Am I right in saying I need to increase <waitservices> and perhaps decrease <waitonline> a little for this to work?
find quote
t4_ravenbird Offline
Senior Member
Posts: 265
Joined: Mar 2012
Reputation: 11
Post: #542
In general, yes. You also may want to investigate the log file (wiki) - all events are time-stamped so it can be helpful to figure out what is going on
find quote
D-an-W Offline
Senior Member
Posts: 163
Joined: Dec 2011
Reputation: 2
Post: #543
Thanks, I set them both to 60 seconds and a couple of seconds after the NAS has fully booted (There is a beep) Kodi launched and all the shares were present.
find quote
krawhitham Offline
Junior Member
Posts: 4
Joined: Aug 2014
Reputation: 0
Post: #544
WOL not working on Fire TV using shared library

Log file
http://xbmclogs.com/pvsmd0jv1

I need Kodi to wake a mysql server up a load the DB but it fails to do so on the android version of KODI running on a Fire TV.

Wake on lan works if I do not have a shared library
When using a shared library if the server is running KODI loads and works great
When using a shared library if the server is sleeping KODI just shows a black screen for about a five minutes and then it exits


The same config files running on a PC version of KODI wakes the mysql server up and everything runs great

I must be doing something wrong because WOL wiki page clearly states it would work
Quote: Kodi can automatically issue a 'wake-on-lan' packet to MySQL or a file sharing server right before it needs to connect to it.
find quote
t4_ravenbird Offline
Senior Member
Posts: 265
Joined: Mar 2012
Reputation: 11
Post: #545
I thinkit is an Android or FireTV specific issue so your question is better in the Android section where it was first asked ; http://forum.kodi.tv/showthread.php?tid=...pid2123934
find quote
leejk Offline
Senior Member
Posts: 277
Joined: Feb 2015
Reputation: 3
Post: #546
Hello,

I have recently move my library databases over to Mysql. The issue is that Kodi is auto starting on an Intel NUC with an SSD, so Kodi is trying to access the MySQL db before any network interface is up. I have enabled wake on access, and I see it listed in the log, but it never apparently does anything. Any thoughts on what the issue is?

http://goo.gl/BmPPyJ

Here is what is in the xml file:

<onaccesswakeup>
<netinittimeout>20</netinittimeout>
<netsettletime>500</netsettletime>
<wakeup>
<host>192.168.0.101</host>
<mac>00:11:32:4C:42:F1</mac>
<pingport>3306</pingport>
<pingmode>1</pingmode>
<timeout>300</timeout>
<waitonline>40</waitonline>
<waitonline2>40</waitonline2>
<waitservices>5</waitservices>
</wakeup>
</onaccesswakeup>

UPDATE: Also noticed that when turning this option off then back on in settings -> system -> power settings that this error is partially shown in KODI:

23:10:52 T:140605468432128 ERROR: Unable to lookup host: 'A2F997BB-34BA-38F2-94BE-DDAB427254A2'
23:10:52 T:140605468432128 ERROR: DoWork - can't determine ip of 'A2F997BB-34BA-38F2-94BE-DDAB427254A2'
23:10:52 T:140605468432128 ERROR: OnJobComplete - Mac discovery failed for host 'A2F997BB-34BA-38F2-94BE-DDAB427254A2'

I've no idea what host name that is since everything uses IP addresses.
thx
(This post was last modified: 2015-12-02 06:16 by leejk.)
find quote
t4_ravenbird Offline
Senior Member
Posts: 265
Joined: Mar 2012
Reputation: 11
Post: #547
Last thing first ;
Host 'A2F997BB-34BA-38F2-94BE-DDAB427254A2' is an upnp-server and not supported so that is the reason for this silly message, a fix is pending here ; https://github.com/xbmc/xbmc/pull/4940

For your main-issue I dont understand why it does not kick in ; it should, and you seem to be using it exactly as intended.
"Starting Kodi (15.2 Git:02e7013)" .. Are you running the release-version of Kodi 15.2 or something home-built ?
find quote
leejk Offline
Senior Member
Posts: 277
Joined: Feb 2015
Reputation: 3
Post: #548
It's a release build. The wakeonaccess does not require a valid network connection does it? If you noticed in the logs, the hue addon also fails because it says it can't find the hue bridge. The NUC is booting so fast that an active network connection is never present before everything else is up and running.

For the other fix, I'm guessing that won't be available for Isengard?
(This post was last modified: 2015-12-03 03:57 by leejk.)
find quote
t4_ravenbird Offline
Senior Member
Posts: 265
Joined: Mar 2012
Reputation: 11
Post: #549
I think I found it, your startup is fast enough so that within the same second that the WakeOnAccess is initalized also the db lookup is done. Notice timestamp is same in log line #136 and #454 and that will incorrectly bypass the wakeup procedure since there is a bug that requires clock to be larger than startup-time. I will fix it.
This might also explain @krawhitham 's issue above actually, but logs are no longer available so I cannot investigate any longer.
find quote
t4_ravenbird Offline
Senior Member
Posts: 265
Joined: Mar 2012
Reputation: 11
Post: #550
PR created ; https://github.com/xbmc/xbmc/pull/8474

I tried to bump the upnp-fix a few months ago but sorry I have no idea if/when it will be included.
If you raise your issue also on the bug-tracker that may get more attention but I dont know
find quote
leejk Offline
Senior Member
Posts: 277
Joined: Feb 2015
Reputation: 3
Post: #551
Ok, thx for figuring it out. As a fix for my current situation, I put a sleep 25 command in my startup script that launches Kodi. Not ideal but it seems to work.
find quote
thosti Offline
Junior Member
Posts: 9
Joined: Jun 2015
Reputation: 0
Post: #552
Hi!
Could someone pls explain me the difference between waitonline, waitonline2 and waitservices.
I've read the hole thread and wiki, but I still do not get it :-(
- What happens after waitonline, waitonline2 and waitservices?
- When exactly is ICMP or "connect attempt" done?
- The shown percentage in kodi is calculated by a summary of waitonline + waitonline2 + waitservices?

Thx in advance!
find quote
t4_ravenbird Offline
Senior Member
Posts: 265
Joined: Mar 2012
Reputation: 11
Post: #553
Hi,
yes there are quite a few params, it was to get all things working, but could have been cleaned up now.

Anyway this is the simplified sequence;
Code:
function                             | display                                  | timeout
--------------------------------------------------------------------------------------------------
loop until network available         | "Waiting for network to connect..."      | "netinittimeout"
ping and early success-exit if reply |                                          | (fixed) 0,5 sec
send wol                             |                                          |
loop and ping until reply            | "Waiting for server to wake up..."       | "waitonline"
loop and ping until reply            | "Extended wait for server to wake up..." | "waitonline2"
abort with fail-status if no reply   |                                          |
just wait fixed amount of time       | "Waiting for services to launch..."      | "waitservices"

At all steps, if some error occur, the sequence can be aborted with fail-status

Only after this function returns an actual "connect attempt" will be done to whatever service was invoked (MySQL, SMB, NFS etc) - this function is just here to help the "connect attempt"to wake and wait until the connection is actually possible.

See also the source of this sequence
find quote
htpcero Offline
Senior Member
Posts: 126
Joined: May 2009
Reputation: 0
Post: #554
(2015-10-06 17:08)krawhitham Wrote:  WOL not working on Fire TV using shared library

Log file
http://xbmclogs.com/pvsmd0jv1

I need Kodi to wake a mysql server up a load the DB but it fails to do so on the android version of KODI running on a Fire TV.

Wake on lan works if I do not have a shared library
When using a shared library if the server is running KODI loads and works great
When using a shared library if the server is sleeping KODI just shows a black screen for about a five minutes and then it exits


The same config files running on a PC version of KODI wakes the mysql server up and everything runs great

I must be doing something wrong because WOL wiki page clearly states it would work
Quote: Kodi can automatically issue a 'wake-on-lan' packet to MySQL or a file sharing server right before it needs to connect to it.


Could you fix your problem? I have been used wakeonlan (RPi waking up a fedora-based NFS share) for a while and it was working perfectly. Now I migrated my Audio library to MySQL (on the same server that has the NFS share), and for some reason Kodi (16.1) on the raspberry pi is no longer sending the WOL packet (the log shows that kodi does not even attempt to send the packet).
Wondering if having both the NFS share and the MySQL server on the same box is confusing Kodi's wake-on-lan feature.

The server still wakes-up with no issue when sending the packet manually from the command line of the raspberry
find quote
htpcero Offline
Senior Member
Posts: 126
Joined: May 2009
Reputation: 0
Post: #555
(2014-05-06 09:49)t4_ravenbird Wrote:  I see no error in any of your logs - but they are very short and stops only 20-30 seconds after WakeOnAccess reports "server started" ; you need to provide the full log

".. I .. put the computer to sleep .."
Did you force-sleep your server prematurely? Before the TimeOut specified (300 secs) ?
This is not allowed and will break your system and cause symptoms like you report

You must wait until the server goes to sleep after its idle-timeout and the idle-timeout must be >= WakeOnAccess parameter TimeOut

Here's my current scenario:

Kodi Client = raspberry Pi with OSMC, configured to wake up my main Kodi HTPC that hosts: a) NFS file server, b) MySQL; this client is always-on
Main Server: fedora server: running NFS server, MySQL server, and another Kodi; Idle Time out = 35 minutes


For many months, my raspberry was using a local DB instead of MySQL, and was accessing my content remotely via NFS. I had in my wakeonlan.xml:

Timeout = 2100
Pingport = 0
Pingmode =1


This worked great. Even if I manually sent the main server to sleep in the evening, the raspberry always woke it up before accessing the NFS share the morning after. I never noticed a single problem in many months with this use pattern.

Now I configured the raspberry to use a remote MySQL DB, on the same Main Server as described above, and I see a very strange behavior.
After a clean reboot of the raspberry or a kodi service restart, I can see that a WOL packet is sent to the main server (apparently the OSMC skin triggers a query of all media DBs), and all works OK.

Then if for any reason I force-sleep the main server, and I attempt to playback content in the raspberry I see in the raspberry a log entry:

Code:
Can't connect to MySQL server on '192.168.x.x' (113)

... it fails WITHOUT any previous attempt to wake up the server, i.e. there is no "WakeOnAccess ... triggered by..." etc. It just doesn't trigger. I understand this could happen if I attempt this within "2100 seconds" of a successful "wake on lan" ping... if I understood correctly how this Kodi feature works.

But here is the issue: if I wait e.g. 35 minutes for the "wake on lan" timeout to expire, and then try to play content, I would have thought that upon the next MySQL access, the WOL packet will be sent. However this is not happening: after the first MySQL failure, the raspberry won't sent a WOL packet again until Kodi is restarted.

It seems that NFS access either bypass the "ping timeout" and always trigger a ping/WOL or alternatively if an NFS connectivity issue happens, a WOL is sent afterwards. However, MySQL can't recover from a single access error.

I tried changing the Pingport to 3306 (MySQL) and noticed that in the log, Kodi was logging a WakeOnAccess every "TimeOut" seconds, keeping the server awake for ever (and unable to handle a single force-sleep) - hence it was useless.

Is there something I could be missing to get Wake On Lan working properly with MySQL? ... other than removing MySQL and going back to local DB Smile
(This post was last modified: 2016-05-20 01:39 by htpcero.)
find quote
Post Reply