You are not logged in.
I am trying to update my mirrorlist every two days with a reflector.service and reflector.timer. My reflector.service works, but the reflector.timer does not run properly, it fails with the following information:
/etc/systemd/system/reflector.timer:5: Failed to parse calendar specification, ignoring: "Mon,Wed,Fri,Sat *-*-* 11:00:00"
Jan 16 21:01:26 RANDOM7 systemd[1]: reflector.timer: Timer unit lacks value setting. Refusing.
My reflector.timer looks like this:
[Unit]
Description=Run reflector every two days
[Timer]
OnCalendar="Mon,Wed,Fri,Sat *-*-* 11:00:00"
Persistent=true
[Install]
WantedBy=timers.target
I have tested the OnCalendar expression by using:
systemd-analyze calendar "Mon,Wed,Fri,Sat *-*-* 11:00:00"
and the result appears to be fine:
Normalized form: Mon,Wed,Fri,Sat *-*-* 11:00:00
Next elapse: Fri 2018-01-19 11:00:00 PST
(in UTC): Fri 2018-01-19 19:00:00 UTC
From now: 1 day 22h left
What am I doing wrong here?
Last edited by luser (2018-01-18 09:24:33)
luser: an epithet applied by Windows users to linux users
Offline
Offline
Since the format is correct, you probably have to remove the quote marks.
Edit: ayekat beat me.
Last edited by progandy (2018-01-17 20:37:45)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
I appreciate the responses.
I did not try removing the quotes when testing the service, though I did replace with single quotes which didn't work.
The reason I didn't try it without quotes, is that when I used "systemd-analyze calendar Mon,Wed,Fri,Sat *-*-* 11:00:00", I got an output that seemed too complicated vs trying it with the quotes, which simply output one result as shown earlier above. Here's the output without quotes:
Original form: Mon,Wed,Fri,Sat
Normalized form: Mon,Wed,Fri,Sat *-*-* 00:00:00
Next elapse: Fri 2018-01-19 00:00:00 PST
(in UTC): Fri 2018-01-19 08:00:00 UTC
From now: 1 day 9h left
Original form: *-*-*
Normalized form: *-*-* 00:00:00
Next elapse: Thu 2018-01-18 00:00:00 PST
(in UTC): Thu 2018-01-18 08:00:00 UTC
From now: 9h left
Original form: 11:00:00
Normalized form: *-*-* 11:00:00
Next elapse: Thu 2018-01-18 11:00:00 PST
(in UTC): Thu 2018-01-18 19:00:00 UTC
From now: 20h left
Nonetheless, when I remove the quotes, save the timer file, and 'systemd daemon-reload' and check the status of the timer, it seems OK. I am thinking it's resolved it, but I want to see it work before marking this issue resolved.
Last edited by luser (2018-01-17 22:55:38)
luser: an epithet applied by Windows users to linux users
Offline
OK, but what happens when you don't use quote in the timer file?
The systemd-analyze command you used is parsed by your shell, which explains the need for quotes. Systemd configuration files aren't so the quotes are being taken literally.
Last edited by Slithery (2018-01-17 23:10:16)
Offline
After looking things over, including the systemd timers wiki again, I believe what's happening is that it's necessary to use quotes when using systemd-analyze, but not when using OnCalendar in the timer file itself. This is not spelled out, but the examples are written that way, apparently for a reason. I'm marking this solved.
Thanks for pointing me in the right direction.
Last edited by luser (2018-01-18 09:25:28)
luser: an epithet applied by Windows users to linux users
Offline
This is not spelled out, but the examples are written that way, apparently for a reason.
Yes, this is because of the way the shell works: spaces and asterisks have special meanings there, so you have to handle them specially in the shell (but not in systemd-unit files).
Instead of quotes, you could also type this:
systemd-analyze calendar Mon,Wed,Fri,Sat\ \*-\*-\*\ 11:00:00
Normalized form: Mon,Wed,Fri,Sat *-*-* 11:00:00
Next elapse: Fri 2018-01-19 11:00:00 CET
(in UTC): Fri 2018-01-19 10:00:00 UTC
From now: 24h left
Offline