I've built a program and I want to run it every 5 mins at round time (**:00, **:05, **:10, ..., not **:01, **:06, **:11, ... or **:03, **:08, **:13, ...).

As I've read, it's better to use systemd than crontab, so I want to use systemd. And I understand how to launch program every 5 mins, but it doesn't launch at round time. I know I can try to launch the program at **:00 so next time it will launch at **:05 and etc, but it seems to be a too silly way.

How do I launch program like this with systemd? Or I can't do it with systemd and I should use crontab?


I don’t think there’s a nice shortcut, but you can do this by listing the possible times in OnCalendar=:

OnCalendar=*-*-* *:0,5,10,15,20,25,30,35,40,45,50,55:00

in normalised form.

systemd usually allows itself a minute of leeway on calendar events; you can tighten this by specifying AccuracySec=.

  • Yep, it works nice! Thank you! – Aphro Disiac Sep 8 '20 at 23:17

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.