23

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
Stephen Kitt
  • 434,908
raspi
  • 1,376

1 Answers1

17

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.

Stephen Kitt
  • 434,908
  • Not working here: Failed to restart {foo}.service: Operation refused, unit {foo}.service may be requested by dependency only. – eMPee584 Jul 09 '19 at 18:22
  • @eMPee584 that’s presumably because your service is configured to refuse manual stops/starts (RefuseManualStart). Please ask a new question is you want more help. – Stephen Kitt Jul 10 '19 at 11:31
  • thanks for the hint; actually it's RefuseManualStart=no RefuseManualStop=yes.. and for whatever reason, manual invocation is working now.. ah well : ) – eMPee584 Jul 18 '19 at 09:59