Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. English
  3. Scripting / Logic
  4. Blockly
  5. cronjobs constantly not being executed on time

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.3k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.5k

cronjobs constantly not being executed on time

Geplant Angeheftet Gesperrt Verschoben Blockly
8 Beiträge 2 Kommentatoren 942 Aufrufe 2 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • P Offline
    P Offline
    Pausentee
    schrieb am zuletzt editiert von Pausentee
    #1

    I have several cron timers in my scripts. They are all out of time.
    The odd thing is: the delay is always different for every job but constant every day. That means the timers delay differs for every cronjob, sometimes a few minutes, sometimes half an hour. But the difference doesn't change from day to day. It stays that way.
    System time of the Raspberry is always correct. CPU load is no problem at all.

    Timers are supposed to start at the full hour, here is how it looks:
    javascript.1 2021-10-20 14:08:04.479 info script.js.common.TestTimer: test on14:08:04
    javascript.12021-10-20 13:01:01.529 info script.js.common.TestTimer: test on13:01:01
    javascript.1 2021-10-20 12:07:35.291 info script.js.common.TestTimer: test on12:07:35
    javascript.1 2021-10-20 11:04:11.698 info script.js.common.TestTimer: test on11:04:11
    javascript.1 2021-10-20 10:29:30.745 info script.js.common.TestTimer: test on10:29:30

    RPi 4 DietPi Bullseye
    ioBroker 6.3.5
    JS-Controller 5.0.19
    Nodejs 18.17.1
    npm 9.6.7

    Thomas BraunT 1 Antwort Letzte Antwort
    0
    • P Pausentee

      I have several cron timers in my scripts. They are all out of time.
      The odd thing is: the delay is always different for every job but constant every day. That means the timers delay differs for every cronjob, sometimes a few minutes, sometimes half an hour. But the difference doesn't change from day to day. It stays that way.
      System time of the Raspberry is always correct. CPU load is no problem at all.

      Timers are supposed to start at the full hour, here is how it looks:
      javascript.1 2021-10-20 14:08:04.479 info script.js.common.TestTimer: test on14:08:04
      javascript.12021-10-20 13:01:01.529 info script.js.common.TestTimer: test on13:01:01
      javascript.1 2021-10-20 12:07:35.291 info script.js.common.TestTimer: test on12:07:35
      javascript.1 2021-10-20 11:04:11.698 info script.js.common.TestTimer: test on11:04:11
      javascript.1 2021-10-20 10:29:30.745 info script.js.common.TestTimer: test on10:29:30

      Thomas BraunT Online
      Thomas BraunT Online
      Thomas Braun
      Most Active
      schrieb am zuletzt editiert von
      #2

      @pausentee

      Maybe the systemtime is running out of sync.
      The Raspberry is lacking a hardware clock, maybe you want to add one.
      These things cost few euros.

      Linux-Werkzeugkasten:
      https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
      NodeJS Fixer Skript:
      https://forum.iobroker.net/topic/68035/iob-node-fix-skript
      iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

      P 1 Antwort Letzte Antwort
      0
      • Thomas BraunT Thomas Braun

        @pausentee

        Maybe the systemtime is running out of sync.
        The Raspberry is lacking a hardware clock, maybe you want to add one.
        These things cost few euros.

        P Offline
        P Offline
        Pausentee
        schrieb am zuletzt editiert von
        #3

        @thomas-braun

        ok, is there way to examine and proove this theory. Because every time I check system time it is correct.
        It also wouldn't explain that time differences are so diffently, right?

        RPi 4 DietPi Bullseye
        ioBroker 6.3.5
        JS-Controller 5.0.19
        Nodejs 18.17.1
        npm 9.6.7

        Thomas BraunT 1 Antwort Letzte Antwort
        0
        • P Pausentee

          @thomas-braun

          ok, is there way to examine and proove this theory. Because every time I check system time it is correct.
          It also wouldn't explain that time differences are so diffently, right?

          Thomas BraunT Online
          Thomas BraunT Online
          Thomas Braun
          Most Active
          schrieb am zuletzt editiert von
          #4

          @pausentee

          Timekeeping on a Raspberry is a thing of it's own...

          AFAIK systemd takes care of it and when a difference is recognized the process will try to get in sync by shortening or expanding the duration of a second until it reaches synchronity. But this fails / will take ages when the load on the system is high, further dragging the time out of sync.

          You also can try to revert time sync back to the classic system. But this is best executed in connection with a real hardware clock.

          Linux-Werkzeugkasten:
          https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
          NodeJS Fixer Skript:
          https://forum.iobroker.net/topic/68035/iob-node-fix-skript
          iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

          P 1 Antwort Letzte Antwort
          0
          • Thomas BraunT Thomas Braun

            @pausentee

            Timekeeping on a Raspberry is a thing of it's own...

            AFAIK systemd takes care of it and when a difference is recognized the process will try to get in sync by shortening or expanding the duration of a second until it reaches synchronity. But this fails / will take ages when the load on the system is high, further dragging the time out of sync.

            You also can try to revert time sync back to the classic system. But this is best executed in connection with a real hardware clock.

            P Offline
            P Offline
            Pausentee
            schrieb am zuletzt editiert von Pausentee
            #5

            @thomas-braun

            But: During testing this issue I checked system time immediately after the cronjob was executed (late) and system time was fine. So there is definetly a difference between 'iobroker measures time' and what system time really is.
            Also: Time differences wouldn't be the same every day.

            But certainly there is also the question of how would the OS handle it. In my case I use DietPi and DietPi offers different methods of timesyncd doing its job. Some of them are not very reliable as I know from experince. If only executed daily or even hourly it would lead to inaccuracies.
            I have chosen to run it as deamon and dynamic adjustments which seems to work best.

            I just don't know how to handle this, because like this iobroker without working timers is just useless to me.

            RPi 4 DietPi Bullseye
            ioBroker 6.3.5
            JS-Controller 5.0.19
            Nodejs 18.17.1
            npm 9.6.7

            Thomas BraunT 1 Antwort Letzte Antwort
            0
            • P Pausentee

              @thomas-braun

              But: During testing this issue I checked system time immediately after the cronjob was executed (late) and system time was fine. So there is definetly a difference between 'iobroker measures time' and what system time really is.
              Also: Time differences wouldn't be the same every day.

              But certainly there is also the question of how would the OS handle it. In my case I use DietPi and DietPi offers different methods of timesyncd doing its job. Some of them are not very reliable as I know from experince. If only executed daily or even hourly it would lead to inaccuracies.
              I have chosen to run it as deamon and dynamic adjustments which seems to work best.

              I just don't know how to handle this, because like this iobroker without working timers is just useless to me.

              Thomas BraunT Online
              Thomas BraunT Online
              Thomas Braun
              Most Active
              schrieb am zuletzt editiert von
              #6

              @pausentee

              I have no experience with DietPi so I don't know how this topic is being handled by this distro.
              Not that I would know how it exactly is done on Raspberry OS...

              Linux-Werkzeugkasten:
              https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
              NodeJS Fixer Skript:
              https://forum.iobroker.net/topic/68035/iob-node-fix-skript
              iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

              P 2 Antworten Letzte Antwort
              0
              • Thomas BraunT Thomas Braun

                @pausentee

                I have no experience with DietPi so I don't know how this topic is being handled by this distro.
                Not that I would know how it exactly is done on Raspberry OS...

                P Offline
                P Offline
                Pausentee
                schrieb am zuletzt editiert von Pausentee
                #7

                @thomas-braun
                It is basically not very much different than any other Linux system.

                Here as an example:
                I made sure that system time is correct shortly befor 14:00h:
                systemctl start systemd-timesyncd
                checked time with 'date'
                Tue Nov 2 13:52:29 CET 2021

                Then waited for the 14:00h Timertest cronjob, which lead to the following result:
                javascript.1 2021-11-02 14:02:32.901 script.js.common.test: TimerTest 14:02:32

                since then:
                15:07:19
                16:02:15
                17:07:45

                Systemtime absolutly on spot.

                So now I am still looking into iobroker, nodejs ...
                My thinking is that the cron implementaion of nodejs is not very reliable, heard about other issues too. Maybe restarting the iobroker.service every day might help.
                any enlightenment would be appreciated

                RPi 4 DietPi Bullseye
                ioBroker 6.3.5
                JS-Controller 5.0.19
                Nodejs 18.17.1
                npm 9.6.7

                1 Antwort Letzte Antwort
                0
                • Thomas BraunT Thomas Braun

                  @pausentee

                  I have no experience with DietPi so I don't know how this topic is being handled by this distro.
                  Not that I would know how it exactly is done on Raspberry OS...

                  P Offline
                  P Offline
                  Pausentee
                  schrieb am zuletzt editiert von Pausentee
                  #8

                  @thomas-braun
                  Hi Thomas,
                  can you think of anyone in the team who is familiar with the topic and has the knowledge to examine this issue.
                  Because I think this is an iobroker/nodejs issue not a Raspberry one.
                  I'd rather first try to solve this problem before switching to another project.

                  I should add another discovery. If I re-save my script shortly before the time is due, it would be on time.

                  RPi 4 DietPi Bullseye
                  ioBroker 6.3.5
                  JS-Controller 5.0.19
                  Nodejs 18.17.1
                  npm 9.6.7

                  1 Antwort Letzte Antwort
                  0
                  Antworten
                  • In einem neuen Thema antworten
                  Anmelden zum Antworten
                  • Älteste zuerst
                  • Neuste zuerst
                  • Meiste Stimmen


                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  820

                  Online

                  32.4k

                  Benutzer

                  81.6k

                  Themen

                  1.3m

                  Beiträge
                  Community
                  Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                  ioBroker Community 2014-2025
                  logo
                  • Anmelden

                  • Du hast noch kein Konto? Registrieren

                  • Anmelden oder registrieren, um zu suchen
                  • Erster Beitrag
                    Letzter Beitrag
                  0
                  • Home
                  • Aktuell
                  • Tags
                  • Ungelesen 0
                  • Kategorien
                  • Unreplied
                  • Beliebt
                  • GitHub
                  • Docu
                  • Hilfe