Prescripts and postscripts
Contributors
Download PDF of this page
You can use custom prescripts and postscripts as part of your data protection operations. These scripts enable automation either before your data protection job or after. For example, you might include a script that automatically notifies you of data protection job failures or warnings. Before you set up your prescripts and postscripts, you should understand some of the requirements for creating these scripts.
Supported script types
Only Perl scripts are supported.
Script path location
Prescripts and postscripts are run by the SnapCenter Plug-in for VMware vSphere. Therefore, the scripts must be located on the SnapCenter VMware plug-in VM.
The script path is validated at the time the script is executed.
Where to specify scripts
Scripts are specified in backup policies. When a backup job is started, the policy automatically associates the script with the resources being backed up.
When you create a backup policy, the wizards in some plug-ins provide separate fields to specify prescripts and postscripts. Other wizards only provide a single field for both.
To specify multiple scripts, press Enter after each script path to list each script on a separate line. Semicolons (;) are not allowed. You can specify multiple prescripts and multiple postscripts. A single script can be coded as both a prescript and a postscript and can call other scripts.
When scripts are executed
Scripts are executed according to the value set for BACKUP_PHASE.
-
BACKUP_PHASE=PRE_BACKUP
Prescripts are executed in the PRE_BACKUP phase of the operation.
If a prescript fails, the backup completes successfully, and a warning message is sent. |
-
BACKUP_PHASE=POST_BACKUP or BACKUP_PHASE=FAILED_BACKUP
Postscripts are executed in the POST_BACKUP phase of the operation after the backup completes successfully or in the FAILED_BACKUP phase if the backup does not complete successfully.
If a postscript fails, the backup completes successfully, and a warning message is sent. |
Environment variables passed to scripts
You can use the environment variables shown in the following table in scripts.
Environment variable | Description |
---|---|
|
Name of the backup. |
|
Date of the backup, in the format |
|
Time of the backup, in the format |
|
The phase of the backup in which you want the script to run. |
|
The number of storage snapshots in the backup. |
|
One of the defined storage snapshots, in the following format: |
|
The number of VMs in the backup. |
|
One of the defined virtual machines, in the following format: |
Script timeouts
The timeout for backup scripts is 15 minutes and cannot be modified.