I am trying to get a simple systemd service to run on a timer unit. For some reason, systemd doesn't seem to like the way I am specifying time. The script worked when I used minutely
or daily
as the value for OnCalendar
, but now I want to set it to 5 minutes and systemd gives an error:
/etc/systemd/system/backup.timer:7: Failed to parse calendar specification, ignoring: 5m
backup.timer: Timer unit lacks value setting. Refusing.
Thing is, according to this page, minutes
should be an understood unit of time. They have 2hours
as an example timespan that should work there, so I don't understand why 5m
or 5minutes
is somehow invalid.
Here is my timer file:
[Unit]
Description=Timer unit for backup.service
Requires=backup.service
[Timer]
Unit=backup.service
OnCalendar=5m
[Install]
WantedBy=timers.target
The other thing is, when I run systemd-analyze timespan 5minutes
it does not return an error, and it seems to be able to parse the value correctly:
Original: 5minutes
μs: 300000000
Human: 5min
OnCalendar=
expects a time-stamp, not a time-span. For time-span, you probably wantOnActiveSec=
orOnBootSec=
.