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).
Best Answer
Which would work. Otherwise you must either:
systemctl start foobar.timer
systemctl restart timers.target
systemctl status
will now showfoobar.timer
as "active (waiting)".As per don_crissti's comment, enabling the timer with
--now
also works: