Issue
I am trying to populate a CRON expression that will pretend to be never executed(at least not in this life time).
I went through this SO question
https://stackoverflow.com/questions/8324306/cron-job-that-will-never-execute
But each expression in that question gives an exception
Microsoft.Azure.WebJobs.Host: Error indexing method 'Cleanup'. Microsoft.Azure.WebJobs.Extensions: The schedule expression '0 0 5 31 2 ?' was not recognized as a valid cron expression or timespan string.
What are the possible expressions that will fullfill the above mentioned expectation with regard to Azure Functions?
Thank you.
Solution
Please check the Azure CRON expression, it's:
{second} {minute} {hour} {day} {month} {day-of-week}
And it uses the NCronTab library to interpret CRON expressions. In the github page you could find the value column can have a *
or a list of elements separated by commas. That means it doesn't support ?
.
So just change your expression to 0 0 5 31 2 *
it will be approved. And if you don't your function running you could just disable it. You could refer to this tutorial: How to disable functions in Azure Functions.
Update:
Due to the Function will calculate the Timer to get the function running time and the 2/30 and 2/31 will never come, then it will be in a loop calculation and the year will increase until beyond the limit 9999. In this situation the function will send a exception.
Answered By - George Chen Answer Checked By - Cary Denson (WPSolving Admin)