OSMC with MySQL never disconnects from NAS

I have 3 Raspberry Pi2 running OSMC, connected to a central MySQL database running on a Synology NAS, media is served up using SMB shares. I find that the NAS never hibernates because the Pi’s maintain their connection to the NAS 7x24. I believe its keeping the MySQL connection open as opposed to the SMB share. If I physically turn the Pi’s off then hibernation works as normal.

Does anyone know of a way to sever the link, either based on screensaver timeout within Kodi, so that when the screensaver kicks in, it writes the current watched status (if applicable) to the database, then disconnects from MySQL / SMB share.

Alternatively is there a way of using the CEC to detect the TV state, for example when the is in Standby then Kodi would stop (gracefully using the shutdown method), and when not in standby Kodi would start?

Kodi will keep the MySQL connection open all the time and some things such as some skins and addons may also periodically perform background actions that require SQL queries.

So no, you can’t configure Kodi to drop its MySQL connection when it is “idle”. Personally I don’t see the point of hibernating a NAS - the whole point of a NAS is being a single always on storage location for multiple computers and devices around the house, if even one of those makes a request of any kind the NAS would wake up.

Although spinning down hard drives when not “in use” saves a small amount of power, the constant spinning down and spinning up actually shortens the life of the drive over just leaving it running. A high percentage of hard drive failures occur when the drive powers up.

Laptop hard drives spin down when idle purely for battery saving reasons, even though it puts more stress on the drive and shortens its life. Desktop PC’s don’t generally spin their drives down by default.

1 Like