Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

WebJobs List
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.
Creating new WebJob

like image 522
Cameron Aavik Avatar asked Aug 02 '16 00:08

Cameron Aavik


People also ask

Should my Azure webjobs be always on?

In that article I noted that "In order to guarantee to run your WebJobs successfully, your Web App needs to be Always On." If you run an Azure Web App in the free tier, it will stop running after about twenty minutes and will restart automatically the next time you visit the site.

How do I set up self-keepalive on Azure web jobs?

Got to the Azure Portal, select your web app, choose the WebJobs blade and click +Add. Give the job a suitable name (I called it self-keepalive ), upload self-keepalive.ps1, set it to be Triggered and Scheduled and enter 0 */5 * * * * as the CRON Expression (which will run every five minutes).

What time does the webjob Trigger Run?

A screenshot of the WebJobs in the portal is shown below. 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.

How do I set up a webjob to run every 5 minutes?

Upload self-keepalive.ps1 as a WebJob and set it to run every five minutes via the CRON trigger 0 */5 * * * *. Add any other WebJobs you want to run (e.g. self-web-keepalive.ps1 if you want to keep your free Web App running continuously).


1 Answers

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.

like image 177
David Ebbo Avatar answered Oct 27 '22 06:10

David Ebbo