Can't Start Systemd Timer

Moses Wynn

I have the following systemd timer configuration

[Unit]
Description=Timer for Service

[Timer]
Unit=service-unit.service
OnCalendar=Mon..Fri *-*-* 13..23:0,15,30,45:00
# *-*-* means every day and 10:00:00 is the time of day (UTC)

[Install]
WantedBy=timers.target

When attempting to start the timer I receive the following error message:

Failed to parse calendar specification, ignoring: Mon..Fri *-*-* 13..23...5,30,45:00 service-timer.timer lacks value setting. Refusing.

I tried checking the timestamp with systemd-analyze calendar "Mon..Fri *-*-* 13..23:5,30,45:00" but my version does not seem to have this option. It returns Unknown operation 'calendar'.

When attempting on a different server where the calendar option is available it seems to be a valid timestamp.

$ sudo systemd-analyze calendar "Mon..Fri *-*-* 13..23:0,15,30,45:00"

  Original form: Mon..Fri *-*-* 13..23:0,15,30,45:00
Normalized form: Mon..Fri *-*-* 13..23:00,15,30,45:00
    Next elapse: Thu 2020-09-10 14:00:00 EDT
       (in UTC): Thu 2020-09-10 18:00:00 UTC
       From now: 1min 21s left

The server where it is not working is CentOS 7 and the server where it is working is Ubuntu 18.04 Minimal.

Moses Wynn

Thanks to all those who answered. For me, the best option was to update systemd using a backport from Facebook that I found here. This way I can take advantage of newer features rather than use workarounds.

After updating from 219 to 231 it worked without issue. The basic update instructions provided in that repo are as follows:

Installation Instructions

  1. Make sure to edit /etc/selinux/config and put SELinux to permissive before you update, otherwise your system will not boot anymore!
  2. # wget https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo
  3. # yum update systemd
  4. Reboot.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related