Jon Leach
Jon Leach

Reputation: 871

How to stop/cancel a running Azure webjob?

We've deployed an on demand Azure webjob and it is in an endless loop. We figured out the bug, did a redeploy and that failed. So we deleted the old job and went to deploy it again but now the job won't start. There is a file called triggeredJob.lock that I've tried to delete but it is in use and I believe that is what's causing the conflict.

Is there a way to recycle the whole app to get this to stop and release the files?

Upvotes: 33

Views: 34954

Answers (5)

Popa Andrei
Popa Andrei

Reputation: 2469

You have to do a few steps before you can remove the "triggeredJob.lock" file that keeps your job locked. First, you have to stop both the App Service and the SCM and for this. In order to close the SCM you have to find your web job on https://resources.azure.com/ (expand Subscriptions-> resourceGroups-> providers-> Microsoft.Web-> sites-> ...) and edit the "scmSiteAlsoStopped" property into "true".

Once both the App Service and SCM are stopped, you can use an FTP client to remove the "triggeredJob.lock" file from your server. After this, you need to start the App Service again.

You can find more details about how you can remove the "triggeredJob.lock" file here.

Upvotes: 0

rGiosa
rGiosa

Reputation: 365

Open App Service Configuration, create a WEBJOBS_STOPPED entry and set its value to 1 or 0. I think this is the easiest way!

Upvotes: 5

Kunal
Kunal

Reputation: 77

Hope your issue resolved. In case if you stooped webjob and still looks like getting desired output. For eg one webjob wrote to send emails after 1 hrs daily. But after stopped it still sending emails. So if this is PRODUCTION it is not good practice to restart application. You can do one thing go to app setting and keep always on setting to OFF. This will remove unnecessary running process for same webjob.

Hope this help

Regards Kunal

Upvotes: 1

BHUVANESH MOHANKUMAR
BHUVANESH MOHANKUMAR

Reputation: 2777

Here are the steps to Kill a Web Jobs in Azure,

Kudu is the Tool in Azure to check Background process.

Kudu URL Format: yourWebSite.scm.azurewebsites.net

Sample URL: google.scm.azurewebsites.net

Login to KUDU web site portal

In Kudu - Select the Process option Menu option

Select on Web Jobs – that suppose to be killed [Properties]

Use Kill Option below, drag down to see the "KILL" button

Click on button "KILL", Killing of Process – Indicated [Red Color]

Once Process Killed Successfully, it will not be displayed.

How ever the webjobs will be in Failed state.

enter image description here

Upvotes: 31

David Ebbo
David Ebbo

Reputation: 43193

Two solutions:

The simplest is to just hit the Restart button in the Azure portal for the Web App that hosts your WebJob, giving a clean start to all processes.

The more complex but less heavy weight is to go to your Web App's Kudu Console. From there, click on the Process Explorer tab. Find the relevant WebJob process in the list, right click it and choose Kill.

Upvotes: 58

Related Questions