Grisha S asked:
Here is my timer:
[Unit] Description=Do whatever [Timer] OnCalendar=daily UTC [Install] WantedBy=timers.target
It fails to start with the following error:
Failed to start mytimer.timer: Unit mytimer.timer failed to load: Invalid argument. See system logs and 'systemctl status mytimer.timer' for details.
systemctl status doesn’t add any clarity to the error message
But, if I remove the UTC literal, it works perfectly:
[Unit] Description=Do whatever [Timer] OnCalendar=daily [Install] WantedBy=timers.target
What am I doing wrong?
This document describes the format accepted by
OnCalendar, and it shows that UTC can be used.
Yes, I tried using quotes – doesn’t help. I also tried using the normalized form – same thing
- OS: CentOS 7
- kernel: 3.10.0-042stab113.21
- systemd: systemd-219-19.el7_2.9.x86_64
OnCalendar= with any timestamp suffixed by
UTC requires systemd 228 or later. This functionality was added in systemd 228.
From the systemd changelog:
CHANGES WITH 228:
- Wherever systemd expects a calendar timestamp specification
(like in journalctl’s –since= and –until= switches) UTC
timestamps are now supported. Timestamps suffixed with “UTC”
are now considered to be in Universal Time Coordinated
instead of the local timezone. Also, timestamps may now
optionally be specified with sub-second accuracy. Both of
these additions also apply to recurring calendar event
specification, such as OnCalendar= in timer units.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.