I have a special case. My MySQL database is running over an old Intel Atom Ubuntu Server. It took over a minute and a half (poor fella) to boot after a power shortage and the Rpi which manages the library syncing boots early than this server. The result of this is that Kodi boots without MySQL library references and the RPi which makes all my libraries syncs, fails. This makes me power off and on that RPi after any power shortage to regain MySQL access.
Is there any chance to add an optional config for wait Kodi’s boot until a MySQL db is available for ping? If not, do you know any configuration method to avoid this behavior?
Thanks,
Martin
PD: In defense of the poor, old and loyal Atom Ubuntu Server, once the boot is made, it runs very well a bunch of stuff
Mmm, no, that function does what it says: Wait for network on the Wifi adapter side. This is not a network problem, my router boots fast, network is available, but my MySQL starts after my Kodi devices, so Kodi devices don’t wait for MySQL to start and the result is no libraries available to sync or even use.
There’s a feature built into Kodi since R13 - take a look here: http://kodi.wiki/view/Wake_on_lan
In short, Kodi can be configured to check for a working connection to an SMB- or a remote SQL-server prior to start and load data.
Just because the wake on lan packet sent will do nothing does not matter. What matters is that an attempt to access the MySQL server will send a wake on lan packet (which does nothing in this case) and then wait for the MySQL server start responding. See the configuration recommendation at the bottom of the linked page that says to use ping port 3306 and ping mode 1.
Sorry, I assumed that once the “Wake on Lan” signal is thrown it will fail to process the rest of parameters if the ping response from server shows already alive. My bad.
I will test and share the results here.
Did it work? I found this thread while looking for a solution to the same problem. My delay is a lot longer though because I have MySQL running on a windows server running in a VM. It’s over 10 minutes to boot from a cold power state.
Nope. It just takes that long. It’s over 3 minutes for the machine just to post (adapted raid drivers take a while)then hyper V takes a few minutes. Then the VM takes about 5. It’s also a domain controller so it’s not particularly fast.
The boot time really isn’t a problem. It only happens on power failures that are more than 20 minutes. (Longer than UPS runtime) In my neck of the woods that’s once every few months or so. I can easily wait for the server to come back up. It’s just annoying that I have to run around the house rebooting osmc boxes a second time. It would be smoother if they just waited to boot. I suppose I could always script a remote osmc reboot on the windows server to run a minute or so after it boots. Any idea off hand what the call is to execute a osmc reboot via curl or something like that.
You just need to calculate your worst MySQL boot time and add that time to every “Wake on Lan” config on every device you have. All devices will then wait that amount of time if after a ping don’t receive any response from MySQL on start.
Unfortunately, the service don’t do periodical polling, so after one ping failed fired plus the time you configured, OSMC starts ignoring any MySQL setting. This could be a problem if your MySQL start time is too variable.
It Is not the best or the most intelligent solution, but it worked for me.
Then unfortunately you have a network issue outside the scope of OSMC’s init system and Kodi. We can’t account for drops in the network. You shouldn’t really have to restart your MySQL server.