Force systemd timer to run immediately

systemd

I'm writing a service with a timer and got wrong WorkingDirectory in the .service file. Timer runs as expected. How I can force run for the service's timer now that I've revisited the .service file?

I've tried:

$ systemctl --user enable $(pwd)/mycollector.service
$ systemctl --user start mycollector.timer
$ systemctl --user reload mycollector.timer

and

$ systemd-run --user mycollector.timer

But it's still waiting:

$ systemctl --user list-timers
NEXT                         LEFT       LAST PASSED UNIT              ACTIVATES
Thu 2019-06-20 23:53:28 UTC  43min left n/a  n/a    mycollector.timer mycollector.service

Best Answer

I don’t think you can force the timer to stop waiting and fire immediately, short of changing its calendar definition; but you can force the corresponding service to run:

systemctl --user start mycollector.service

The timer will fire as scheduled, later on.

Related Question