Kodi Community Forum
Kodi not start if the MySQL server is stopped - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Windows (https://forum.kodi.tv/forumdisplay.php?fid=59)
+---- Thread: Kodi not start if the MySQL server is stopped (/showthread.php?tid=218263)

Pages: 1 2


Kodi not start if the MySQL server is stopped - Vaiojuan - 2015-02-13

Kodi not start if the MySQL server is stopped
Good morning,
First data from the PC.

1. kodi Version 14.1 Git: 20150129-38e4046
2. Windows 7 SP1
3. HP-Pavilion Intel ® Core ™ i3 CPU 530 @ 2.93GHz, 4 cores
4. 4Gb Ram

I have shared database on the external hard disk of a HTPC that is not 24h on.
I have another PC that reads the database of the HTPC, but if the HTPC is stopped when starting Kodi in the PC crashes searching the database and does not start Kodi and I can not stop, have to force shutdown from Administrator tasks. I've created a separate profile Masterprofile to be shared database of HTPC, but also feel the same, if I select the profile with the MySQL database if the HTPC is off Kodi stays looking Database "ERROR: Unable to open database ".

Is there any way that does not hang up and put a message like that is not based rather than crash? or put a break? or a certain time of refusal?

I have not heard attach text file is not the clip.

Thank You

PS I used the search but my English translator based on google and found nothing.
The idea of this is that a PC so I have some time, children etc, for the use of my kids, movies and so have not always on the HTPC since I do not have NAS.


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

Only thing I could think of right now would be to manually start Kodi in portable mode on your other client if thy MySQL server is offline.
This way you would be able to start Kodi as always from your user profile using it's advancedsettings.xml to connect to your db, and to start it with the switch -p to create and use a portable profile folder inside Kodis program folder.
Read here: http://kodi.wiki/view/Windows_FAQ#Portable_mode


RE: Kodi not start if the MySQL server is stopped - trogggy - 2015-02-13

If you do that (and it sounds like a nice bit of lateral thinking) I think you'll need to move your kodi folder out of program files - portable mode won't work there as you're writing to the folder.


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

You are of course right in that only Administrators can use portable mode like this, but one could work around that Wink

(...thinking of a manually started task that's configured to run with elevated rights by default and executing a script that at first checks whether the sql server is online or not and depending on the result just starts Kodi normally or in portable mode...)

Translator:
Usted, por supuesto justo en que sólo los administradores pueden utilizar el modo portátil como este, pero uno podría evitar que Wink

(... pensando en una tarea iniciada manualmente que está configurado para funcionar con derechos elevados por defecto y ejecutar un script que al primero comprueba si el servidor SQL está conectado o no y dependiendo del resultado justo empieza Kodi normalmente o en modo portátil .. .)


RE: Kodi not start if the MySQL server is stopped - trogggy - 2015-02-13

I'd like to see such a script (genuinely).


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

...ok... here's something quick and dirty Tongue

Translator:
... ok ... aquí hay algo rápido y sucio

Code:
@echo off
cls
:: start with assuming the MySQL server is offline
set isSQLon=n
::
:: MySQL server IP address
set ip=192.168.1.11
::
:: look for cpu architecture
if %PROCESSOR_ARCHITECTURE%==x86 (set kodi="%ProgramFiles%\Kodi\") else set kodi="%ProgramFiles(x86)%\Kodi\"
::
:: Ping MySQL server...
:: ...if it answers, change value of isSQLon...
(ping -n 3 %ip% | find "TTL") > nul && set isSQLon=y
:: ...if not, stay with isSQLon=n
(ping -n 3 %ip% | find "TTL") > nul || set isSQLon=n
:: decide what to do
if /i %isSQLon%==n (start /D %kodi% kodi.exe -p) else start /D %kodi% kodi.exe

Just did a quick test, and it works - if running with elevated rights.
Manually starting it from the task scheduler also works, but it's a bit effortful to naviagte to the task scheduler, which, again, needs elevated rights in the first place...

The easiest solution is to just manually create the folder 'portable_data' and alter its NTFS permissions for all users to r/w - this way the script doesn't need to run elevated Smile

Translator:
Acabo de hacer una prueba rápida, y funciona - si se ejecuta con derechos elevados.
Inicio manual desde el programador de tareas también funciona, pero es un poco con esfuerzo a naviagte para el programador de tareas, que, de nuevo, necesita derechos elevados en el primer lugar ...

La solución más fácil es crear sólo manualmente la carpeta 'portable_data' y modificar sus permisos NTFS para todos los usuarios de r / w - de esta manera el guión no necesita ejecutar elevado Smile


RE: Kodi not start if the MySQL server is stopped - trogggy - 2015-02-13

Brilliant!
Just out of interest - and relevant to the OP's situation I suppose - do you know if there are any disadvantages to moving the kodi folder out of program files? I haven't installed to there for years (I always do portable installations and copy them across machines).


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

I couldn't think of any: if Kodi is executed normally, it will use the user's '%appdata%\Kodi' anyway, it's just the p-switch that tells Kodi to look for the folder 'portable_data' in its own application folder I guess, so for the OP there would be the downside that he'd have to manage sources.xml and so on twice.

Translator:
No podía pensar en ninguna: si Kodi se ejecuta normalmente, se utilizará el usuario de "% appdata% \ Kodi 'de todos modos, es sólo el interruptor p que dice Kodi para buscar la carpeta' portable_data 'en su propia carpeta de la aplicación Supongo, por lo que para la OP no habría el lado negativo que tendría que gestionar sources.xml y así sucesivamente dos veces.


RE: Kodi not start if the MySQL server is stopped - trogggy - 2015-02-13

You could get around that by automating it - freefilesync or something similar set up in task scheduler? - but I imagine it's not worth the effort.


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

...and wouldn't really help either as at least his advancedsettings.xml shouldn't be synchronized to his portable folder due to the fact that there his MySQL server is configured Wink

Anyway, I simply don't know of any built-in Kodi-option to handle the case when an external MySQL database is configured but offline the moment Kodi is started.
There is the WoL option, but that would power on the OPs MySQL-computer, and to me it sounded like he didn't want that...

Translator:
... y no sería una gran ayuda, ya sea como mínimo su advancedsettings.xml no debe ser sincronizado a su carpeta portátil debido al hecho de que hay a su servidor MySQL se configuraWink

De todos modos, yo simplemente no sé de cualquier incorporada Kodi-opción para manejar el caso cuando se configura una base de datos externa MySQL pero fuera de línea el momento Kodi se inicia.
Existe la opción WoL, pero eso sería encender el PO MySQL-ordenador, y me sonaba como él no quería que ...


RE: Kodi not start if the MySQL server is stopped - trogggy - 2015-02-13

Sorry you're right - I was thinking you could sync individual files, not just folders. Should call it freefoldersync.
You could still do it though - set up a batch file to one-way sync the folders, then copy advancedsettings.xml and the videodatabase in from a saved folder to the second one. Run that via task scheduler. Still not worth it though.

Is there any way you could run a python script at startup to check if the video db is present, and switch to a different profile if not?
Just speculating there, I don't have a clue whether that check's possible - if it was though it would be a platform - independent solution.


RE: Kodi not start if the MySQL server is stopped - Vaiojuan - 2015-02-13

Sorry am newbie in Kodi in mysql and my English is based on Google translator. By that I mean that I missed, and I thought I would have a simpler solution, such as adding some línia to advancedsetings, but everything else is beyond me.
I thank you for your help.Big Grin


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

Also sorry: if you can't write in English that's quite fine as we might almost get what's your problem with your using of Google translator.
But if you can't read what we write in English, then you should just say what's your native language, so that with a little luck somebody who can speak your tongue might check in and translate our suggestions to you.
Or maybe we could also try Google translator for this Smile Might be fun!
After all, we are not talking about magic here Wink

Translator:
También lo siento: si no se puede escribir en Inglés que está bastante bien, ya que casi podríamos conseguir lo que es el problema con el uso de traductor de Google.
Pero si usted no puede leer lo que escribimos en Inglés, entonces usted debe simplemente decir lo que es su lengua materna, por lo que con un poco de suerte alguien que puede hablar su lengua podría registrarse y traducir nuestras sugerencias para usted.
O quizás también podríamos tratamos traductor de Google para este Sonrisa Podría ser divertido!
Después de todo, no estamos hablando acerca de la magia aquí Wink


RE: Kodi not start if the MySQL server is stopped - Vaiojuan - 2015-02-13

My native language is Spanish. And he sought a solution if possible not be external, because if gives problems the easiest solution is scraper the library at 2 PC, and lose functionality to share videos viewed.


RE: Kodi not start if the MySQL server is stopped - Fry7 - 2015-02-13

Ok, then get rid of your shared database and just run Kodi separately on your clients.
This way you would need your media sources to be available to all clients at any time at least - but as you stated, you do not have a NAS or something similiar, so how you would manage that then is out of my scope...

Translator:
Ok, entonces deshacerse de su base de datos compartida y sólo ejecute Kodi separado en sus clientes.
De esta manera usted tendría sus medios de comunicación que esté disponible a todos los clientes por lo menos en cualquier momento - pero como usted dijo, usted no tiene un NAS o algo similar, así que cómo usted manejaría que entonces está fuera de mi alcance...


EDIT:
Ok, this is fun: I almost don't understand anything of what the Google Translator just spit out of my bad English to be Spanish now. Should work on this myself...

EDIT2:
Rofl ...you don't want to know what happend to my small Win-Script after translating it to Spansih... hilarious Laugh

EDIT3:
Seriously, DON'T try to translate script-code - it surely won't run... just to be certain.