Reputation: 3410
We have an Azure Website setup with a "staging" deployment slot, and we use a continuous Azure WebJob to process long-running background jobs. It appears that when you publish to the Website (and include the WebJob binaries), that the WebJob will restart itself if it was previously stopped.
Our current deployment process looks like the following:
Is there a trick (say a flag file or something) to tell a WebJob NOT to start up after publishing?
Upvotes: 15
Views: 5036
Reputation: 3521
You can add Application Setting WEBJOBS_STOPPED
to your staging slot and set it to 1
. Make this setting 'Slot Setting' so that it is not swapped with production.
Upvotes: 22
Reputation: 9182
To deploy a continuous WebJob in a stopped state simply add a file called disable.job
at the root of your WebJob (binaries), this will tell the framework that the WebJob is currently stopped.
To view this behavior you can simply stop a continuous WebJob and see that this file is generated and placed at the WebJob's directory.
Upvotes: 22
Reputation: 28425
AFAIK, there is no out of the box solution for that. However, you can set an app setting and have the webjob code check for it when it starts. Also, you can use the HTTP_HOST
variable to figure out the environment.
Upvotes: 0