Azure Webjobs ignores CRON expression

I have a program that I want to run once a day. I put my program.exe and my settings.job file into one zip file and downloaded it. I continued to work continuously. My settings. Job looks like this:

{ "schedule": "0 0 8 * * *" } 

My plan was that it works every day at 8, but instead, it repeats all the time again and again. What have I done wrong?

+5
source share
2 answers

The webjob mode should be On Demand :

From the documentation:

  • You still need to enable Always On to enable the application.
  • Note When deploying WebJob from Visual Studio, be sure to mark the properties of the settings.job file as "Copy if new."
+5
source

After several unsuccessful attempts to make the elusive Azure WebJob run on a CRON expression, following the best online tutorials:

I finally managed to complete my tasks in the cron schedule.

For me .json settings in the root folder never worked. What worked and was actually extremely easy to implement was using the Azure Webjobs SDK extensions. This approach gives you maximum flexibility in implementing planning, it is very well documented, and there are complete sample projects for it: https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/ExtensionsSample/Samples /TimerSamples.cs

With a function definition that is just like this, you can start and run cron scheduling:

public static void CronJob([TimerTrigger("0 */5 * * * *")] TimerInfo timer) { Console.WriteLine("Cron job fired!"); }

Webjobs extensions also open up a whole world of other possibilities, so it's 100% worth checking if you are using Azure Webjobs: https://github.com/Azure/azure-webjobs-sdk-extensions

+3
source

All Articles