# Edge Jobs

{% hint style="warning" %}
This is a beta feature.
{% endhint %}

Adding an Edge job can be used to schedule jobs in your Edge hosts. Jobs can be used to run any scripts you need, for example running a backup in a specified period of time.

{% hint style="info" %}
This functionality requires you to [enable Edge Compute](https://docs.portainer.io/sts/admin/settings/edge) features, and is currently only available for Docker Standalone environments that use `/etc/cron.d` for job scheduling.
{% endhint %}

{% hint style="danger" %}
Edge jobs run by modifying the crontab on the underlying host, not in a container. This means that Edge jobs can make changes to the host directly, which is very powerful but also very dangerous, so use with caution.
{% endhint %}

From the menu select **Edge Jobs** then click **Add Edge job**.

<figure><img src="https://679325054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMdgxA76kWxcRmwybM8Ft%2Fuploads%2FFETA6y90zXDkSgSKaGG1%2F2.40.0-add-edge-job.gif?alt=media&#x26;token=ddc71b9f-d9a9-4181-95eb-0b125ecabaa7" alt=""><figcaption></figcaption></figure>

Give the job a descriptive name then select one of the following options:

| Option                 | Overview                         |
| ---------------------- | -------------------------------- |
| Basic Configuration    | Select a date from the calendar. |
| Advanced Configuration | Write your own `cron` rule.      |

For a basic configuration, enable **Recurring Edge job** and select the **Edge job time** if you want the job to repeat. If you want the job to run only once, leave **Recurring Edge job** disabled and specify the **Scheduled date** instead.\
For an advanced configuration, enter a **Cron rule** to define the schedule.

{% hint style="info" %}
The Edge job schedule date is based on the time on the host, not the Portainer Server. Bear this in mind when scheduling jobs across time zones.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/fSLJwC4x1tFoF2t3hLPR/2.15-edge-jobs-config.png" alt=""><figcaption></figcaption></figure>

You can then use the web editor to write the script or paste a copy in.

Once your script is ready, you can choose where to deploy it. You can select [Edge Groups](https://docs.portainer.io/sts/user/edge/groups) to deploy to with the **Edge Groups** dropdown.

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/RBHfHWO3OOox8Y5jGHYM/2.17-edge-jobs-groups.png" alt=""><figcaption></figcaption></figure>

You can also select environments individually in **Target environments**. Click on an environment in the **Available environments** list to move it to the **Associated environments** list as a deployment target.

<figure><img src="https://content.gitbook.com/content/MdgxA76kWxcRmwybM8Ft/blobs/lnp63pZpvynrc36WWuJj/2.15-edge-jobs-targetenvs.png" alt=""><figcaption></figcaption></figure>

Once you have made your selections, click **Add edge job** to create and run the job.
