So I have my service unit (runs some node code) and my timer unit Service:
[Unit] Description=foo [Service] Type=oneshot ExecStart=/home/ubuntu/services/foo/start.sh
[Unit] Description=foo timer [Timer] OnBootSec=0min OnCalendar=*-*-* 05:01:00 UTC Unit=foo.service [Install] WantedBy=multi-user.target
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.