• Strange systemd timer behaviour

    From Grimble@2:250/1 to All on Thu Aug 11 17:06:25 2022
    I was interested to see if I could launch a small program at one-second intervals, so I wrote a small python script to write a two variable row
    to a database (timestamp, 10 character string). Not wanting to create
    the X.service/X.timer entries in /etc/systemd/, I set up a transient
    systemd timer as follows:
    systemd-run --timer-property=AccuracySec=1us --on-calendar '*:*:1' /home/graeme/Software/Python/write1.py
    expecting the '*:*:1' string to be interpreted as every second.
    However results were very strange:
    2022-08-11 15:00:01.04493 | abcdefghij
    2022-08-11 15:00:01.04534 | abcdefghij
    2022-08-11 15:00:01.045509 | abcdefghij
    2022-08-11 15:00:01.046762 | abcdefghij
    2022-08-11 15:00:01.047677 | abcdefghij
    2022-08-11 15:00:10.040712 | abcdefghij
    2022-08-11 15:01:01.044398 | abcdefghij
    2022-08-11 15:01:01.044442 | abcdefghij
    2022-08-11 15:01:01.045927 | abcdefghij
    2022-08-11 15:01:01.045973 | abcdefghij
    2022-08-11 15:01:01.046043 | abcdefghij
    2022-08-11 15:01:10.041792 | abcdefghij
    2022-08-11 15:02:01.045485 | abcdefghij
    2022-08-11 15:02:01.045624 | abcdefghij
    2022-08-11 15:02:01.045988 | abcdefghij
    2022-08-11 15:02:01.047145 | abcdefghij
    2022-08-11 15:02:01.048968 | abcdefghij
    2022-08-11 15:02:10.042064 | abcdefghij

    In other words, 5 firings within a very short time followed by one 10
    seconds later. This behaviour was consistent over a 40 hour period.

    Over a shorter period, replacing the string with '*:*:10' (?every 10
    seconds?) gave
    2022-08-11 15:27:01.045152 | abcdefghij
    2022-08-11 15:27:01.045541 | abcdefghij
    2022-08-11 15:27:01.046604 | abcdefghij
    2022-08-11 15:27:01.04555 | abcdefghij
    2022-08-11 15:27:01.048399 | abcdefghij
    2022-08-11 15:27:10.042014 | abcdefghij
    2022-08-11 15:27:10.042807 | abcdefghij

    5 firings within 3 millisecs followed by 2 firings

    Over a shorter period, replacing the string with '*:1:00' (?every 1
    minute?) gave the same results as the '*:*;1' string.

    Have I misunderstood the specification of the "on-calendar" parameter?


    --
    Grimble
    Machine 'Haydn' running Plasma 5.20.4 on 5.15.58-desktop-2.mga8 kernel.
    Mageia release 8 (Official) for x86_64


    --- MBSE BBS v1.0.8 (Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From Grimble@2:250/1 to All on Fri Aug 12 10:31:30 2022
    I was interested to see if I could launch a small program at one-second intervals, so I wrote a small python script to write a two variable row
    to a database (timestamp, 10 character string). Not wanting to create
    the X.service/X.timer entries in /etc/systemd/, I set up a transient
    systemd timer as follows:
    systemd-run --timer-property=AccuracySec=1us --on-calendar '*:*:1' /home/graeme/Software/Python/write1.py
    expecting the '*:*:1' string to be interpreted as every second.
    However results were very strange:
    2022-08-11 15:00:01.04493 | abcdefghij
    2022-08-11 15:00:01.04534 | abcdefghij
    2022-08-11 15:00:01.045509 | abcdefghij
    2022-08-11 15:00:01.046762 | abcdefghij
    2022-08-11 15:00:01.047677 | abcdefghij
    2022-08-11 15:00:10.040712 | abcdefghij
    2022-08-11 15:01:01.044398 | abcdefghij
    2022-08-11 15:01:01.044442 | abcdefghij
    2022-08-11 15:01:01.045927 | abcdefghij
    2022-08-11 15:01:01.045973 | abcdefghij
    2022-08-11 15:01:01.046043 | abcdefghij
    2022-08-11 15:01:10.041792 | abcdefghij
    2022-08-11 15:02:01.045485 | abcdefghij
    2022-08-11 15:02:01.045624 | abcdefghij
    2022-08-11 15:02:01.045988 | abcdefghij
    2022-08-11 15:02:01.047145 | abcdefghij
    2022-08-11 15:02:01.048968 | abcdefghij
    2022-08-11 15:02:10.042064 | abcdefghij

    In other words, 5 firings within a very short time followed by one 10
    seconds later. This behaviour was consistent over a 40 hour period.

    Over a shorter period, replacing the string with '*:*:10' (?every 10
    seconds?) gave
    2022-08-11 15:27:01.045152 | abcdefghij
    2022-08-11 15:27:01.045541 | abcdefghij
    2022-08-11 15:27:01.046604 | abcdefghij
    2022-08-11 15:27:01.04555 | abcdefghij
    2022-08-11 15:27:01.048399 | abcdefghij
    2022-08-11 15:27:10.042014 | abcdefghij
    2022-08-11 15:27:10.042807 | abcdefghij

    5 firings within 3 millisecs followed by 2 firings

    Over a shorter period, replacing the string with '*:1:00' (?every 1
    minute?) gave the same results as the '*:*;1' string.

    Have I misunderstood the specification of the "on-calendar" parameter?


    --
    Grimble
    Machine 'Haydn' running Plasma 5.20.4 on 5.15.58-desktop-2.mga8 kernel.
    Mageia release 8 (Official) for x86_64


    --- MBSE BBS v1.0.8 (Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From David W. Hodgins@2:250/1 to All on Sat Aug 13 02:53:46 2022
    On Fri, 12 Aug 2022 05:31:30 -0400, Grimble <grimble@nomail.afraid.org> wrote:

    I was interested to see if I could launch a small program at one-second intervals, so I wrote a small python script to write a two variable row
    to a database (timestamp, 10 character string). Not wanting to create
    the X.service/X.timer entries in /etc/systemd/, I set up a transient
    systemd timer as follows:
    systemd-run --timer-property=AccuracySec=1us --on-calendar '*:*:1' /home/graeme/Software/Python/write1.py
    expecting the '*:*:1' string to be interpreted as every second.
    However results were very strange:
    2022-08-11 15:00:01.04493 | abcdefghij
    2022-08-11 15:00:01.04534 | abcdefghij
    <snip>
    Have I misunderstood the specification of the "on-calendar" parameter?

    I've never used systemd-run. On Mageia 8 none of the man pages mention --timer-property=AccuracySec. That may be something that was added in a
    newer version of systemd.

    Mageia 8 has version 246. The online documentation mentions "By default, the timer will execute a random amount of time between when the specified time is reached, and one minute after"

    Since the m8 version doesn't appear to support the timer-property so gets the random timing.

    Cauldron currently has systemd version 251.

    Are you using m8 or a cauldron install?

    Regards, Dave Hodgins

    --- MBSE BBS v1.0.8 (Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From Bit Twister@2:250/1 to All on Sat Aug 13 03:34:35 2022
    On Fri, 12 Aug 2022 21:53:46 -0400, David W. Hodgins wrote:
    On Fri, 12 Aug 2022 05:31:30 -0400, Grimble <grimble@nomail.afraid.org> wrote:

    I was interested to see if I could launch a small program at one-second
    intervals, so I wrote a small python script to write a two variable row
    to a database (timestamp, 10 character string). Not wanting to create
    the X.service/X.timer entries in /etc/systemd/, I set up a transient
    systemd timer as follows:
    systemd-run --timer-property=AccuracySec=1us --on-calendar '*:*:1'
    /home/graeme/Software/Python/write1.py
    expecting the '*:*:1' string to be interpreted as every second.
    However results were very strange:
    2022-08-11 15:00:01.04493 | abcdefghij
    2022-08-11 15:00:01.04534 | abcdefghij
    <snip>
    Have I misunderstood the specification of the "on-calendar" parameter?

    I've never used systemd-run. On Mageia 8 none of the man pages mention --timer-property=AccuracySec. That may be something that was added in a
    newer version of systemd.

    Mageia 8 has version 246. The online documentation mentions "By default, the timer will execute a random amount of time between when the specified time is reached, and one minute after"

    Since the m8 version doesn't appear to support the timer-property so gets the random timing.

    Cauldron currently has systemd version 251.

    Are you using m8 or a cauldron install?

    A quick
    man -k systemd | grep -i time
    give several selections on my mga 8 release.

    $ man systemd.timer
    and doing a
    /AccuracySec
    for searching gets me a AccuracySec description.

    --- MBSE BBS v1.0.8 (Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From David W. Hodgins@2:250/1 to All on Sat Aug 13 04:24:48 2022
    On Fri, 12 Aug 2022 22:34:35 -0400, Bit Twister <BitTwister@mouse-potato.com> wrote:

    On Fri, 12 Aug 2022 21:53:46 -0400, David W. Hodgins wrote:
    On Fri, 12 Aug 2022 05:31:30 -0400, Grimble <grimble@nomail.afraid.org> wrote:

    I was interested to see if I could launch a small program at one-second
    intervals, so I wrote a small python script to write a two variable row
    to a database (timestamp, 10 character string). Not wanting to create
    the X.service/X.timer entries in /etc/systemd/, I set up a transient
    systemd timer as follows:
    systemd-run --timer-property=AccuracySec=1us --on-calendar '*:*:1'
    /home/graeme/Software/Python/write1.py
    expecting the '*:*:1' string to be interpreted as every second.
    However results were very strange:
    2022-08-11 15:00:01.04493 | abcdefghij
    2022-08-11 15:00:01.04534 | abcdefghij
    <snip>
    Have I misunderstood the specification of the "on-calendar" parameter?

    I've never used systemd-run. On Mageia 8 none of the man pages mention
    --timer-property=AccuracySec. That may be something that was added in a
    newer version of systemd.

    Mageia 8 has version 246. The online documentation mentions "By default, the >> timer will execute a random amount of time between when the specified time is
    reached, and one minute after"

    Since the m8 version doesn't appear to support the timer-property so gets the
    random timing.

    Cauldron currently has systemd version 251.

    Are you using m8 or a cauldron install?

    A quick
    man -k systemd | grep -i time
    give several selections on my mga 8 release.

    $ man systemd.timer
    and doing a
    /AccuracySec
    for searching gets me a AccuracySec description.

    That's for timer files such as /etc/systemd/system/fstrim.timer, not for the systemd-run command.

    Regards, Dave Hodgins

    --- MBSE BBS v1.0.8 (Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)
  • From Grimble@2:250/1 to All on Tue Aug 16 16:26:23 2022
    On 13/08/2022 04:24, David W. Hodgins wrote:
    On Fri, 12 Aug 2022 22:34:35 -0400, Bit Twister <BitTwister@mouse-potato.com> wrote:

    On Fri, 12 Aug 2022 21:53:46 -0400, David W. Hodgins wrote:
    On Fri, 12 Aug 2022 05:31:30 -0400, Grimble
    <grimble@nomail.afraid.org> wrote:

    I was interested to see if I could launch a small program at one-second >>>> intervals, so I wrote a small python script to write a two variable row >>>> to a database (timestamp, 10 character string). Not wanting to create
    the X.service/X.timer entries in /etc/systemd/, I set up a transient
    systemd timer as follows:
      systemd-run --timer-property=AccuracySec=1us --on-calendar '*:*:1'
    /home/graeme/Software/Python/write1.py
    expecting the '*:*:1' string to be interpreted as every second.
    However results were very strange:
      2022-08-11 15:00:01.04493  | abcdefghij
      2022-08-11 15:00:01.04534  | abcdefghij
    <snip>
    Have I misunderstood the specification  of the "on-calendar" parameter? >>>
    I've never used systemd-run. On Mageia 8 none of the man pages mention
    --timer-property=AccuracySec. That may be something that was added in a
    newer version of systemd.

    Mageia 8 has version 246. The online documentation mentions "By
    default, the
    timer will execute a random amount of time between when the specified
    time is
    reached, and one minute after"

    Since the m8 version doesn't appear to support the timer-property so
    gets the
    random timing.

    Cauldron currently has systemd version 251.

    Are you using m8 or a cauldron install?

    A quick
      man -k systemd | grep -i time
    give several selections on my mga 8 release.

    $ man systemd.timer
    and doing a
       /AccuracySec
    for searching gets me a AccuracySec description.

    That's for timer files such as /etc/systemd/system/fstrim.timer, not for
    the
    systemd-run command.

    Regards, Dave Hodgins
    Thanks both for your comments. After further reading and testing, it
    seems not to be possible to have a shorter timer interval than 1 minute.
    (Oops- it also seems that the multiple entries was because I had left
    more than one timer running)
    --
    Grimble
    Machine 'Haydn' running Plasma 5.20.4 on 5.15.58-desktop-2.mga8 kernel.
    Mageia release 8 (Official) for x86_64



    --- MBSE BBS v1.0.8 (Linux-x86_64)
    * Origin: A noiseless patient Spider (2:250/1@fidonet)