# Scripts

## Overview

#### There are three types of backup scripts:

1. **Pre-backup** – executed <mark style="color:$danger;">before</mark> the backup starts. You can configure the backup to wait until this script finishes, which is mandatory for scenarios like **SQL** database backups.
2. **Post-snapshot** – executed <mark style="color:$danger;">after</mark> the backup snapshots have been created.
3. **Post-backup** – executed <mark style="color:$danger;">after</mark> the backup completes. For example, this script can be used to shut down the backed-up machine.

***

## Advantages

Using backup scripts can help automate the backup of resources that **Xopero ONE** cannot back up natively. **Xopero ONE** also provides features such as incremental and differential backups, deduplication, flexible scheduling, and detailed monitoring of backup copies.

***

## Enabling backup scripts

{% stepper %}
{% step %}
In the **Create backup plan** view, scroll to the bottom, click **Edit** next to **Advanced settings**, and then select **Backup scripts**.

<figure><img src="/files/fZaSYTCj1oOJuNbFVb8W" alt="" width="536"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Select the type of script you want to enable.

{% hint style="success" %}
You can enable multiple scripts at the same time.
{% endhint %}

<figure><img src="/files/IoJEVMPBu7z8N4yKJ6RS" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Select the operating system (**Windows**, **Linux**, or **macOS**) and choose a [predefined script](#types_of_pre-defined_scripts) from the drop-down list.

<figure><img src="/files/2o0VYyErUR4f6nIW5TSQ" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
If you have selected a script, enable the **Wait for the script to continue the task** checkbox. This ensures that the backup task will wait until the script finishes. You can also configure a waiting interval and choose to fail the task if the script does not complete successfully.

<figure><img src="/files/8nhBzlF5vk3mtuOfjr81" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

## Predefined scripts <a href="#types_of_pre-defined_scripts" id="types_of_pre-defined_scripts"></a>

**Xopero ONE** provides a set of predefined scripts that can be used for common backup tasks. These scripts are ready to use and can be selected directly from the drop-down list when configuring your backup plan.

### <mark style="background-color:blue;">Pre-task scripts</mark>

{% hint style="warning" %}
The script is executed <mark style="color:$danger;">before the backup starts</mark>.
{% endhint %}

<div><figure><img src="/files/ydar4nNculPS1Gc3lszJ" alt=""><figcaption><p><em><strong>Windows OS</strong>.</em></p></figcaption></figure> <figure><img src="/files/AQBlPWcRH0Kv7LrJpr8q" alt=""><figcaption><p><em><strong>Linux</strong> and <strong>macOS</strong>.</em></p></figcaption></figure></div>

1. **SQL Server database backup** — protects a **Microsoft SQL** server database (**Windows** <mark style="color:$danger;">only</mark>).
2. **MySQL database backup** — protects a **MySQL** database (**Windows**, **Linux**, and **macOS**).
3. **PostgreSQL database backup** — protects a **PostgreSQL** database (**Windows**, **Linux**, and **macOS**).
4. **Oracle database backup** — protects an **Oracle** database environment (**Linux** and **macOS** <mark style="color:$danger;">only</mark>).
5. **Enter path\*** — allows you to run a custom script; simply type the path to your script to execute it using **Xopero ONE** (**Windows**, **Linux**, and **macOS**).

### <mark style="background-color:blue;">Post-snapshot scripts</mark>

{% hint style="warning" %}
The script is executed <mark style="color:$danger;">after the data snapshot has been completed</mark>.
{% endhint %}

<figure><img src="/files/aY6JKwaEe18hh73oHaq2" alt=""><figcaption><p><em><strong>Windows OS</strong>.</em></p></figcaption></figure>

1. **SQL Server database backup** — protects a **Microsoft SQL** server database.
2. **MySQL database backup** — protects a **MySQL** database.
3. **PostgreSQL database backup** — protects a **PostgreSQL** database.
4. **Enter path\*** — allows you to run a custom script; simply type the path to your script to execute it using **Xopero ONE**.

### <mark style="background-color:blue;">Post-task scripts</mark>

{% hint style="warning" %}
The script is executed <mark style="color:$danger;">after the backup is completed</mark>.
{% endhint %}

<figure><img src="/files/0IoW7ORs7NZgSEombuMW" alt=""><figcaption></figcaption></figure>

1. **Shutdown** — shuts down the device.
2. **Enter path\*** — allows you to run a custom script; simply type the path to your script to execute it using **Xopero ONE**.

{% hint style="danger" %}
**\***<mark style="color:$danger;">**WARNING!**</mark> If your backup plan includes multiple devices, the script <mark style="color:$danger;">**must**</mark> be located at the same path on all devices where you want it to run.
{% endhint %}

***

## Useful links and items

{% content-ref url="/pages/MLP0XDkxZ7U4QtwyzUCP" %}
[Microsoft SQL database backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup/microsoft-sql-database-backup.md)
{% endcontent-ref %}

{% content-ref url="/pages/IVeDEpwr5CDqeJWUlHoy" %}
[Restoring MySQL database](/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup-recovery/restoring-mysql-database.md)
{% endcontent-ref %}

{% content-ref url="/pages/FDJAMMAXmLDUywGtjt6S" %}
[PostgreSQL database backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup/postgresql-database-backup.md)
{% endcontent-ref %}

{% content-ref url="/pages/brnXKoSSfF6b5PK8adqg" %}
[Oracle database backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup/oracle-database-backup.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpcenter.xopero.com/xopero-one-en/management/backup-plans/scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
