Using WebJobs

 

Updated: August 18, 2015

Applies To: Windows Azure Pack

WebJobs is a feature of the Azure App Service that enables you to run continuous or on-demand programs or scripts in the same context as a web app. Windows Azure Pack: Web Sites supports WebJobs on the management portal for tenants.

The Azure WebJobs SDK simplifies many WebJobs programming tasks. For more information, see What is the WebJobs SDK.

For more information, see Azure WebJobs resources.

WebJobs accept the following file types:

  • .cmd, .bat, .exe (Windows)

  • .ps1 (Windows PowerShell)

  • .sh (Bash)

  • .php (PHP: Hypertext Preprocessor)

  • .py (Python)

  • .js (JavaScript)

To create an on-demand WebJob, follow these steps:

  1. In the Website blade of the Windows Azure Pack management portal for tenants, click All settings and then click WebJobs.

  2. Click Add a Job. The Basic WebJob settings screen appears.

  3. In the Name box, enter a name for the WebJob. The name must start with a letter or a number, and it cannot contain any special characters other than "-" and "_".

  4. In the How to Run box, select Run on Demand.

  5. In the Content box, click the folder icon and browse to the .zip file that contains your script. The .zip file must contain your file (with a .exe, .cmd, .bat, .sh, .php, .py, or .js extension) and any supporting files needed to run the program or script.

  6. Click the check mark to upload the script to your website.

  7. To run the WebJob, select the job and click Run Once in the command bar.

To create a continuously running WebJob, follow the same steps for creating an on-demand WebJob, but in the How to Run box, select Continuous. The code for a continuous job must also be written to run in an endless loop.

To start or stop a continuous WebJob, right-click the WebJob in the list and click Start or Stop.

Continuous jobs run continuously only when the web app is up.

After you create one or more jobs, their names will appear on the WebJobs tab with their status, schedule type, and other information.

The WebJobs tab displays historical information for the last 30 WebJobs.

To view the execution history of a job, including jobs created with the WebJobs SDK, follow these steps:

  1. Click the corresponding link in the Logs column. This opens the details page, which displays the name of the command, when it ran, and its success or failure.

  2. For further details, click a time under Recent job runs. The WebJob Run Details page appears.

  3. Click Toggle Output to see the log contents. The output log is in text format.

  4. To see the output text in a separate browser window, click the download link.

  5. To download the text, right-click the link and use your browser options to save the file contents.

Show: