atifaziz / NCrontab

Crontab for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cycling hour range

UnoSD opened this issue · comments

I am trying to run an Azure Function every 5 minutes between 17 (PM) and 8 (AM).

The expression */5 8-17 * * * works correctly between 8-17, but if I try to reverse it to */5 17-8 * * * to do between 5PM and 8AM, it does not trigger. I verified correctness of cycles (from PM to AM) in regular cron descriptor sites, but I presume NCrontab works differently.

Can you please help with the expression if I am using it incorrectly or can I ask for the support to be added if this is not feasible currently?

EDIT:
I understand this may be by design by looking at other issues, but looks like the NCrontab has been adopted by Azure Functions that don't allow multiple expressions, under those circumstances it is impossible to achieve the cross-midnight ranges.

Thank you

…every 5 minutes between 17 (PM) and 8 (AM).

You can get that with the expression */5 0-8,17-23 * * * (see also on crontab guru). As you've noticed, simply reversing (as in */5 17-8 * * *) doesn't work and is by-design.

I am closing this in the hope that it answers your question.

thank you @atifaziz I managed to get it to work using exactly that syntax, I forgot to close the issue before.