[systemd] OnCalendar timer fires on boot

Problems with packages? Post here, using [tags] of the package name.

[systemd] OnCalendar timer fires on boot

Postby marox » Wed Dec 05, 2018 7:03 pm

Hello all,

after updating rPi and rebooting I noticed that one timer fired (got new insert in DB) this timer is set onCalendar and should fire only on midnight. So I tried to replicate and I created test.service and test.timer (details below) and indeed timer was triggering service unit not only when matching onCalendar value but also after re-boot. As I have one more rPi I tried to replicate it there and I couldn't but after update I got same issue. For (my) sanity check I tried all on VM (Arch x86_64) and all works as should timer will fire only when matching onCalendar and NOT after boot. So please if anyone can replicate and confirm that this is indeed bug or if not point me to some config or whatever can have impact on this behavior.

Thanks!

Some details:
$this->bbcode_second_pass_code('', '
[root@rivendell ~]# pacman -Ss systemd
core/libsystemd 239.303-1 [installed]
')

$this->bbcode_second_pass_code('', '
[root@rivendell ~]# systemctl status test.service
* test.service - Just simple testing service, will echo 'test'.
Loaded: loaded (/etc/systemd/system/test.service; static; vendor preset: disabled)
Active: inactive (dead) since Wed 2018-12-05 19:55:00 CET; 3min 48s ago
Process: 15265 ExecStart=/usr/local/sbin/test.sh (code=exited, status=0/SUCCESS)
Main PID: 15265 (code=exited, status=0/SUCCESS)

Dec 05 19:55:00 rivendell systemd[1]: Started Just simple testing service, will echo 'test'..
Dec 05 19:55:00 rivendell test.sh[15265]: test...
[root@rivendell ~]#
[root@rivendell ~]#
[root@rivendell ~]# systemctl status test.timer
* test.timer - Will run test.service every 5 mins.
Loaded: loaded (/etc/systemd/system/test.timer; enabled; vendor preset: disabled)
Active: active (waiting) since Wed 2018-11-28 01:40:12 CET; 1 weeks 0 days ago
Trigger: Wed 2018-12-05 20:00:00 CET; 1min 8s left

Nov 28 01:40:12 rivendell systemd[1]: Started Will run test.service every 5 mins..
[root@rivendell ~]#
[root@rivendell ~]#
[root@rivendell ~]# cat /etc/systemd/system/test.service
[Unit]
Description=Just simple testing service, will echo 'test'.

[Service]
ExecStart=/usr/local/sbin/test.sh
[root@rivendell ~]#
[root@rivendell ~]#
[root@rivendell ~]# cat /etc/systemd/system/test.timer
[Unit]
Description=Will run test.service every 5 mins.

[Timer]
OnCalendar=*-*-* *:0/5:00
AccuracySec=10ms

[Install]
WantedBy=multi-user.target
[root@rivendell ~]#
')

In log below service should NOT run at 19:32:45...

$this->bbcode_second_pass_code('', '
[root@rivendell ~]# journalctl -b -u test.service | head -n 5
-- Logs begin at Sat 2017-11-25 12:13:06 CET, end at Wed 2018-12-05 20:00:21 CET. --
Dec 05 19:32:45 rivendell systemd[1]: Started Just simple testing service, will echo 'test'..
Dec 05 19:32:45 rivendell test.sh[314]: test...
Dec 05 19:35:00 rivendell systemd[1]: Started Just simple testing service, will echo 'test'..
Dec 05 19:35:00 rivendell test.sh[7159]: test...
')
marox
 
Posts: 1
Joined: Wed Dec 05, 2018 6:44 pm

Return to Packages

Who is online

Users browsing this forum: No registered users and 9 guests