Cron expression - every 5 minutes between 8 and 16:30 inclusive


I schedule ASP.NET Core services and need a cron job done every day every 5 minutes between 8 am and 16:30, including at 8 and 16:30.

Could someone help?

Thank you.


As much as I know it’s not quite possible to please your case with only one cron expression.
You can do this;
*/5 8-16 * * *
which means every five minutes between 8 AM and 4 PM

Then you can do this for the remaining 30 minutes with an additional job registration;
0-30/5 16 * * *
which means every five minutes between 4 PM and 4:30 PM

If the 16:30 is not a strict thing, for the purpose of keeping the job quantity lesser, you can do the first one with 17 instead of 16 so that you can have it your way with an additional 30 minutes.

Thank you very much, Oividios!

My implementation turned out to work only with one job.

I will end up with “*/5 8-16 * * *” - every 5 min from 08:05 until 16:55 (inclusive), which will work with the business requirement.

Thank you for that idea and your help!

1 Like