So I have my service unit (runs some node code) and my timer unit Service:




Description=foo timer 

OnCalendar=*-*-* 05:01:00 UTC 


I understand that systemctl start foo.timer , will start the timer unit but not the service unit immediately (without reboot) and systemctl enable foo.timer will not start the timer unit but start it when the system boots up.

I wanted to start the timer immediatey so I used the former. It did start the timer but it also started my foo.service as I started the timer even though the OnCalendar conditions were not met. It still started correctly at the OnCalendar time, too (I was testing so I chose a time in the near future).

I'm wondering if there is anything in my unit file causing this. I thought that starting the timer would not start the service but only start the service when the condition is fulfilled in the timer.

I did also test the system enable way and that one actually did behave correctly. I enabled my foo.timer. Reboot the system. Timer was active and service wasn't immediately. When the OnCondition time came, the service ran.

1 Answer 1


From systemd.timer(5):

If a timer configured with OnBootSec= or OnStartupSec= is already in the past when the timer unit is activated, it will immediately elapse and the configured unit is started. This is not the case for timers defined in the other directives.

Since your timer unit sets OnBootSec=0min, it will always start the service unit immediately.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .