14

I have a timer that is literally this:

foobar.service:

[Unit]
Description=Timer Test
Requires=rsyslog.service      # rsyslog is an active local service.

[Service]
Type=simple
ExecStart=/usr/bin/logger "Running foobar timer test!"

foobar.timer:

[Unit]
Description=Test Timer

[Timer]
OnCalendar=10:00              # See below about the time.
Unit=foobar.service
RemainAfterElapse=no

[Install]
WantedBy=timers.target

I tested this by installing it (systemctl enable foobar.timer) with the OnCalendar 10 minutes in the future. However, it doesn't run, and:

> systemctl status foobar.timer
● foobar.timer - Local Daily Tasks Timer
   Loaded: loaded (/etc/systemd/system/what.timer; enabled; vendor preset: enabled)
   Active: inactive (dead)
  Trigger: n/a

It claims to be loaded and enabled, but inactive (dead). This is especially perplexing since I've written other timers following this pattern and they all work... o_O?

I've done everything short of rebooting the system (which I don't like to do, it is an active server).

0

1 Answer 1

12

I've done everything short of rebooting the system

Which would work. Otherwise you must either:

  • Explicitly start the timer: systemctl start foobar.timer
  • Or restart the timer target: systemctl restart timers.target

systemctl status will now show foobar.timer as "active (waiting)".

As per don_crissti's comment, enabling the timer with --now also works:

systemctl enable --now foobar.timer
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.