Skip to content

Commit eb3e8c6

Browse files
committed
updates
1 parent b3486ec commit eb3e8c6

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

articles/app-service/quickstart-webjobs.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'Create a scheduled Python WebJob'
33
description: WebJobs on App Service enable you to automate repetitive tasks on your app. Learn how to create scheduled WebJobs in Azure App Service.
4-
ms.topic: how-to
4+
ms.topic: quickstart
55
ms.date: 4/24/2025
66
author: msangapu-msft
77
ms.author: msangapu
@@ -12,14 +12,14 @@ zone_pivot_groups: app-service-webjobs
1212

1313
# Quickstart: Create a scheduled WebJob
1414

15-
WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app. All app service plans support WebJobs. There's no extra cost to use WebJobs. This sample uses a Triggered (scheduled) WebJob to output the system time once every 15 minutes.
15+
WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app. All app service plans support WebJobs at no additional cost. This sample uses a scheduled (Triggered) WebJob to output the system time once every minute.
1616

1717
## Prerequisites
1818

1919
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
20-
- An existing App Service app on Linux. In this quickstart, [a Python app](quickstart-python.md) is used.
21-
- **[Always on](configure-common.md?tabs=portal)** must enabled on your app.
22-
- App setting `WEBSITE_SKIP_RUNNING_KUDUAGENT` set to `FALSE`.
20+
- An existing App Service Python app on Linux. In this quickstart, a [Python app](quickstart-python) is used.
21+
- **[Always on](configure-common.md?tabs=portal#configure-general-settings)** must be enabled on your app.
22+
- Ensure the App setting `WEBSITE_SKIP_RUNNING_KUDUAGENT` is set to `false`.
2323

2424
## Download the sample WebJob
2525

@@ -28,9 +28,12 @@ dotnet
2828
:::zone-end
2929

3030
:::zone target="docs" pivot="python"
31-
[Download the sample project](https://github.com/Azure-Samples/App-Service-Python-WebJobs-QuickStart/archive/refs/heads/main.zip).
3231

33-
The sample Python WebJob is in `webjob.py`. It outputs the current time to the console as shown below:
32+
You can [download a pre-built sample project](https://github.com/Azure-Samples/App-Service-Python-WebJobs-QuickStart/archive/refs/heads/main.zip) to get started quickly.
33+
34+
The sample includes two files that will run the WebJob: `webjob.py` and `run.sh`.
35+
36+
The Python script, `webjob.py`, that outputs the current time to the console as shown below:
3437

3538
```Python
3639
import datetime
@@ -46,7 +49,8 @@ The file, `run.sh`, calls WebJob.py as shown below:
4649
/opt/python/3/bin/python3.13 webjob.py
4750
```
4851

49-
The file, `run.sh` is included to show the capability of WebJobs. You can also omit the file and only include `webjob.py` in the .zip file.
52+
> [!NOTE]
53+
> `run.sh` invokes the Python script. It's included in the .zip to show the flexibility of WebJobs. Depending on your project needs, you can also omit `run.sh` from your WebJob.
5054
5155
:::zone-end
5256

@@ -79,18 +83,30 @@ php
7983
| ------------ | ----------------- | ------------ |
8084
| **Name** | myScheduledWebJob | A name that is unique within an App Service app. Must start with a letter or a number and must not contain special characters other than "-" and "_". |
8185
| **File Upload** | Python-webjob.zip | A *.zip* file that contains your executable or script file and any supporting files needed to run the program or script. The supported executable or script file types are listed in the supported file types section. |
82-
| **Type** | Scheduled | Continous, Triggered, or Scheduled. |
83-
| **Triggers** | Scheduled | For the scheduling to work reliably, `Always On` should be enabled (available in Basic, Standard, and Premium tiers).|
86+
| **Type** | Scheduled | Specifies when the WebJob runs. Choose `Scheduled` to run based on a CRON expression. |
87+
| **Triggers** | Scheduled | Ensure Always On is enabled for the schedule to work reliably. This setting is available in Basic, Standard, and Premium tiers.|
8488
| **CRON Expression** | 0 0/1 * * * * | For this quickstart, we use a schedule that runs every minute. See [CRON expressions](webjobs-create.md?tabs=windowscode#ncrontab-expressions) to learn more about the syntax. |
8589

8690
1. The new WebJob appears on the **WebJobs** page. If you see a message that says the WebJob was added, but you don't see it, select **Refresh**.
8791

88-
1. The scheduled WebJob is run at the schedule defined by the CRON expression. To run it manually at anytime, right-click the WebJob in the list and select the **Run** button, then confirm your selection.
92+
1. The scheduled WebJob is run at the schedule defined by the CRON expression. To run it manually at any time, right-click the WebJob in the list and select the **Run** button, then confirm your selection.
8993

9094
:::image type="content" source="media/webjobs-create/scheduled-webjob-run.png" alt-text="Screenshot that shows how to run a manually scheduled WebJob in the Azure portal.":::
9195

9296
[!INCLUDE [webjobs-cron-timezone-note](../../includes/webjobs-cron-timezone-note.md)]
9397

98+
### How the WebJob runs
99+
100+
When you deploy a scheduled WebJob to Azure App Service, the platform checks for a CRON schedule and runs the script at the specified time intervals. If `run.sh` or `run.py` is present, it's used as the entry point. Otherwise, the platform will use the first `.py` file it detects in the archive, which can lead to unpredictable results.
101+
102+
103+
## Review the WebJob logs
104+
105+
106+
## Clean up
107+
108+
To remove the WebJob, select the WebJob in the portal and select `Delete`.
109+
94110
## <a name="NextSteps"></a> Next steps
95111

96112
The Azure WebJobs SDK can be used with WebJobs to simplify many programming tasks. For more information, see [What is the WebJobs SDK](https://github.com/Azure/azure-webjobs-sdk/wiki).

0 commit comments

Comments
 (0)