0

How can I get the following timer to start automatically? Right now the timer only works if I do systemctl start while-test.timer. Otherwise, eventhough I enabled the timer, it does not start automatically. Even after doing systemctl daemon-reload or rebooting.

while-test .service
-------------------
[Unit]
Description=While loop test script

[Service]
Type=simple
ExecStart=/home/user/bash/while-test.sh

[Install]
WantedBy=default.target

and

while-test .timer
----------------
[Unit]
Description=While loop test script timer

[Timer]
OnCalendar=Mon *-*-* 10:52:00
Unit=while-test.service

[Install]
WantedBy=default.service
  • What is the output of systemctl --all list-timers? Are the timer and unit user specific or system wide? – Munir Aug 31 '17 at 17:44
  • Based on a previous question, can you look at the journal? You should see a few log lines under sudo systemctl status while-test.timer (the sudo may be required to get the logs), or you can use journalctl -b -u while-test.timer – sourcejedi Jul 27 '18 at 18:24
1
systemctl enable while-test.service
systemctl enable while-test.timer

You may need to run these with sudo. This enables the service and timer at boot. Verify that it is enabled with:

systemctl list-timers

This will show status information like next run time, last run time, last passed run, and the service it activates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.