timezone auto update

  • Hi.. I am trying to auto update the timezone, as I have a lot of libreelec pi's, and i am on a ship which regularly crosses into different zones.

    I have managed to automate all my windows and also linux machines using a nightly cron job, based on the zone being evaluated from reverse geocoding the gps NMEA lat/long ..

    its a horrible mess but it works, however i can't change the /etc/localtime flag on a read only system, so the only way to update the zone is in the kodi gui.. as far as i can see, and i have too many, and we travel too often to do that..

    i would be ecstatic if someone knew of an addon that could help.. or a way for me to auto replace the /etc/localtime flag without harming libreelec..

    challenging?

    Many thanks

    JP

  • i would be ecstatic if someone knew of an addon that could help.. or a way for me to auto replace the /etc/localtime flag without harming libreelec..

    Time zone is stored in "/storage/.cache/timezone", and you would need to restart tz-data.service for it to take effect on the OS side. You might need to restart Kodi as well, but I guess you can experiment to find out.

  • Thanks.. I tried that, and after a reboot of the pi, the date command does indeed reflect the correct zone:

    for example

    Mon Dec 27 17:17:12 AST 2021

    which is correct.

    but the GUI time is still reading several hours out on European time..

    Edited once, last by talitha (December 27, 2021 at 9:20 PM).

  • Code
    RPi4:~ # grep Dubai .kodi/userdata/guisettings.xml 
        <setting id="locale.timezone">Asia/Dubai</setting>

    ^ You need to stop Kodi, sed the file, restart Kodi to effect the change, or learn how to make the change live via the JSON API - which is also the best option as this will also pass the change to the /storage/.cache/time`zone file.

  • HI again.. ok, so

    systemctl stop kodi

    sed 's+Europe/Paris+Atlantic/Bermuda+g' guisettings.xml

    this momentarily changes the xml file, but it reverts to Europe/Paris almost instantly

  • driving myself a bit mad.. guisettings.xml reverts as soon as i change it... i read that advancedsettings.xml would work, so i added that too, including the timezone country setting.. i also changed /.cache/timezone

    restart of kodi and the time is correct right up until i use the gui to go to regional settings and suddenly the clock jumps forward several hours.. and /.cache/timezone reverts to paris

  • HI again.. ok, so

    systemctl stop kodi

    sed 's+Europe/Paris+Atlantic/Bermuda+g' guisettings.xml


    this momentarily changes the xml file, but it reverts to Europe/Paris almost instantly

    Does Kodi actually stop?

    Because you should also (re)start Kodi after your sed command.

    Or the sed command doesn't work properly, check its contents before (re)starting Kodi.

  • yes it stops.. well screen goes black and no trace of kodi.bin in TOP..

    i could probably understand guisettings reverting if i had restarted it, but it does it prior to restart..

    i think i'm making headway though..

    created /storage/.kodi/userdata/advancedsettings.xml but changed format so..

    <advancedsettings version="1.0">

    <locale>

    <timezone>Atlantic/Bermuda</timezone>

    <timezonecountry>Bermuda</timezonecountry>

    </locale>

    options to set timezone are now absent from the gui regional settings and the time is now correct!

    this seems to be independent of the system date, which requires the manual changing of /.cache/timezone and a tz-data restart.

    as i'm automating it nightly i suppose i should do both.. but i think its working.. i'll knock up a cron job and see what happens.

    thanks for the help

  • cron job is working a treat.. thanks for your help everyone..one small snag is that i am trying to log the ip and hostname of each LE pi to a remote share.. I have setup /storage/recordings as the mount point for my media files, and i am running the nightly bash script from there also.. but it won't write a log file there as it says read only system.

    storage-recordings.mount - test nfs mount script

    Loaded: loaded (/storage/.config/system.d/storage-recordings.mount; enabled; vendor preset: disabled)

    Active: active (mounted) since Tue 2021-12-28 09:01:07 AST; 1h 54min ago

    Where: /storage/recordings

    What: 192.168.40.65:/share/Multimedia

    Memory: 60.0K

    CGroup: /system.slice/storage-recordings.mount


    anyone know if i can make it writable? its only for the logfile so i'm not super worried

    thx

    J