简体   繁体   中英

Azure WebJob not running as per schedule

I have an issue where an Azure WebJob I created (on a Web App) is not running using the cronjob Trigger I specified. I am able to click on the WebJob, then click Run and it does run fine with no errors. A screenshot of the WebJobs in the portal is shown below.

Web工作清单
As you can see, the Trigger is set to run at 9:30 AM every day, but it is never run automatically as per the trigger, only manually using Run. The WebJob itself is set to run a .exe which is contained inside a .zip.

Here are the settings I used when creating the WebJob.
创建新的WebJob

You need to make sure you have Always On enabled in your App, which requires it to run in Basic or higher mode.

See https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduledCRON for details.

As mentioned in the comments of David Ebbo's answer, the webjob won't be triggered automatically if your CRON expression is not correct.

In this piece of relevant MS documentation , the following CRON expression is mentioned and does not work:

{
"schedule": "0 */15 * * * *"
}

Instead, use this:

{
"schedule": "0 0/15 * * * *"
}

This way I got my webjob running every 15 minutes.

Just putting this here for the googlers.

Remember Azure is running on UTC time so 9:30 in your timezone might be different in Azure time.

I'm PST so if I want to run something at 9:30 I set my CRON expression to 16:30. This becomes a problem with daylight savings time if you need your job to execute at exactly 9:30, you will need to change the CRON expression because UTC does not change with DST.

Faced the similar issue.With reference to the below link

https://raskarovblog.wordpress.com/2017/03/16/why-is-my-azure-webjob-cron-expression-is-not-working/

Azure team states that Azure WebJob CRON uses NCronTab with six parameters (five and seven parameters are not accepted).

If you look at NCronTab Docs, you will notice that they use 5 parameters. Azure team explains that they also pass “Seconds” parameter which is not used by default by NCronTab.

Cron format below

{second} {minute} {hour} {day} {month} {day of the week}

To run the webjobs every day at 9.30 am will be

{"schedule":"0 30 9 * * *"}

And also check the time scheduled in the azure webjobs and your local time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM