4

I'm on Ubuntu 16.04. When I try to use the time syntax show here (Mon..Fri) I get an error. It seems I have to use 'Mon-Fri'.

$ sudo systemctl status mytouch.timer
● mytouch.timer - Runs mytouch every hour
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead) since Thu 2018-12-13 16:16:35 UTC; 1h 11min ago

Dec 13 17:15:20 ip-10-0-0-123 systemd[1]: [/etc/systemd/system/mytouch.timer:5] Failed to parse calendar specification, ignoring: Mon..Fri 22:30
Dec 13 17:15:20 ip-10-0-0-123 systemd[1]: mytouch.timer: Timer unit lacks value setting. Refusing.

Also, I had problems putting the time zone after the date, such as: 2003-03-05 05:40:00 UTC.

Finally, I have seen the suggestion to use systemd-analyze calendar but that produces this error:

$ systemd-analyze calendar Mon,Wed,Fri,Sat\ \*-\*-\*\ 11:00:00
Unknown operation 'calendar'.

Where do I find documentation for the version of systemd I'm running.

Fonnae
  • 213

2 Answers2

1

Edited on 2021/08/10 thanks to @jcomeau_ictx's comment I realized that I had wrongly read the question and provided a misguided answer with a a buggy command as well.

The doted command is indeed partially supported on older versions and you have to use - instead.
I do not have access to older versions anymore, so I can't verify what works and what doesn't anymore (.. can be used to list days for example).
However, you can still use the systemctl list-timers command to see where you stand.

As kindly mentioned by @echo, the systemd-analyze calendar is not available on the 16.04.
I could use it only starting the 18.04 Ubuntu and I don't think there is an equivalent command on older versions.
Good luck.

chaami
  • 111
  • 3
  • 1
    It's not the *-*-*, both older and newer versions accept that. It's the .. notation which the newer version accepts, whereas the older version expects -, to indicate a range of values. And at least on my CentOS7 system, systemd list-timers fails, but systemctl list-timers works as expected. – jcomeau_ictx Aug 08 '21 at 03:23
0

for ubuntu 16.04, the time syntax is http://manpages.ubuntu.com/manpages/xenial/man7/systemd.time.7.html, which is slightly different with the 'standard'.

for systemd-analyze, the ubuntu 16.04 version is also different. below is the output of systemd-analyze -h

Commands:
  time                    Print time spent in the kernel
  blame                   Print list of running units ordered by time to init
  critical-chain          Print a tree of the time critical chain of units
  plot                    Output SVG graphic showing service initialization
  dot                     Output dependency graph in dot(1) format
  set-log-level LEVEL     Set logging threshold for manager
  set-log-target TARGET   Set logging target for manager
  dump                    Output state serialization of service manager
  verify FILE...          Check unit files for correctness
echo
  • 159