HOWTO: Fix Network Race issue MySQL database doesnt connect on boot (no more menus)
#1
For those of you having similar issues..

I had a couple boxes one had an SSD and it appears that the xbmc may have been starting to quickly.
And when xbmc started my menus would disappear - but i would still be able to go through the directory structure and be able to watch movies...

After a lot of reading, It thought this was related only to my SSD drive, but after new install I found that a regular 5400 rpm was going the same thing.

The fix is pretty simple we need to create a script to check that your MySQL server can be reached before xbmc continues.
.
first find your mysql server's ip address:
Code:
cat /home/<your xbmc username>/.xbmc/userdata/advancedsettings.xml |grep '<videodatabase>' -A6

Next we need to change to the following directory:
Code:
cd ~/.config

Then create a file (i use vim (if you want to use it 'sudo apt-get install vim')):
Code:
vim autostart.sh

the contents of your file should be as follows (the ip=1.1.1.1 should be changed to the ip address you found in your advancedsettings.xml file above :
Code:
#!/bin/bash

## Set max tries for PING
count=15
## Set IP to Ping
ip=1.1.1.1

## Run some code
while [[ $count -ne 0 ]];do
    /bin/ping -c 1 $ip &> /dev/null
    rc=$?
    sleep 1
    if [[ $rc -eq 0 ]];then
        count=1
    fi
    ((count=$count-1))
done

then reboot and it should be working:
Code:
sudo reboot

If this helps you let me know by Clicking Here and giving me a Positive Rating
Reply
#2
While I don't use xbmc live or Unix I am wondering if I can use this for my problem.

Xbmc won't boot unless mysql server is up, and the xbmc WOL plugins won't work because they only run when xbmc is fully booted. So if mysql server is not on the WOL plugin doesn't run ....

I'm running on an apple tv2. So is there a way to use something like this to send a magic packet before xbmc loads?
So it wouldn't be a plugin for xbmc, it would be a script outside of xbmc but run when xbmc is clicked on?
Reply
#3
In the script that starts xbmc add a line that sends the WOL packet, then either waitis a predefined time, or waits on a specific event (like the presence of port 3306 (mysql) responding on the server), then starts xbmc.

I don't know how all this works on ATV2, you may have to poke around at the scripts on your system.

Or just leave your mysql server going, that's what servers are for.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply

Logout Mark Read Team Forum Stats Members Help
HOWTO: Fix Network Race issue MySQL database doesnt connect on boot (no more menus)1