Previous Topic: Specify the Advanced SettingsNext Topic: (Optional) Perform a Manual Backup


(Optional) Manage Pre/Post Scripts for Automation

Pre/Post scripts let you run your own business logic at specific stages of a running job. You can specify when to run your scripts in Pre/Post Script Settings of the Backup Wizard and the Restore Wizard in the Console. The scripts can be run on the Backup Server depending on your setting.

Managing the pre/post script is a two part process, consisting of creating the pre/post script and placing the script in the prepost folder.

Create Pre/Post Scripts

Follow these steps:

  1. Log into the Backup Server as a root user.
  2. Create a script file using the environment variables in your preferred scripting language.

    Pre/Post Script Environment Variables

    To create your script, use the following environment variables:

    D2D_JOBNAME

    Identifies the name of the job.

    D2D_JOBID

    Identifies the job ID. Job ID is a number provided to the job when you run the job. If you run the same job again, you get a new job number.

    D2D_TARGETNODE

    Identifies the node that is being backed up or restored.

    D2D_JOBTYPE

    Identifies the type of the running job. The following values identify the D2D_JOBTYPE variable:

    backup.full

    Identifies the job as a full backup.

    backup.incremental

    Identifies the job as an incremental backup.

    backup.verify

    Identifies the job as a verify backup.

    restore.bmr

    Identifies the job as a bare-metal recovery (bmr). This is a restore job.

    restore.file

    Identifies the job as a file-level restore. This is a restore job.

    D2D_SESSIONLOCATION

    Identifies the location where the recovery points are stored.

    D2D_PREPOST_OUTPUT

    Identifies a temp file. The content of the first line of the temp file is displayed in the activity log.

    D2D_JOBSTAGE

    Identifies the stage of the job. The following values identify the D2D_JOBSTAGE variable:

    pre-job-server

    Identifies the script that runs on the Backup Server before the job starts.

    post-job-server

    Identifies the script that runs on the Backup Server after the job completes.

    pre-job-target

    Identifies the script that runs on the target machine before the job starts.

    post-job-target

    Identifies the script that runs on the target machine after the job completes.

    pre-snapshot

    Identifies the script that runs on the target machine before capturing the snapshot.

    post-snapshot

    Identifies the script that runs on the target machine after capturing the snapshot.

    D2D_TARGETVOLUME

    Identifies the volume that is backed up during a backup job. This variable is applicable for pre/post snapshot scripts for a backup job.

    D2D_JOBRESULT

    Identifies the result for a post job script. The following values identify the D2D_JOBRESULT variable:

    success

    Identifies the result as successful.

    fail

    Identifies the result as unsuccessful.

    D2DSVR_HOME

    Identifies the folder where Backup Server is installed. This variable is applicable for the scripts that run on the Backup Server.

The script is created.

Note: For all scripts, a return value of zero indicates success and a nonzero return value indicates failure.

Place the Script in the Prepost Folder and Verify

All the pre/post scripts for a Backup Server are centrally managed from the prepost folder at the following location:

/opt/Arcserve/d2dserver/usr/prepost

Follow these steps:

  1. Place the file in the following location of the Backup Server:
    /opt/Arcserve/d2dserver/usr/prepost
    
  2. Provide the execution permission to the script file.
  3. Log into the Arcserve UDP Agent (Linux) web interface.
  4. Open the Backup Wizard or the Restore Wizard and navigate to the Advanced tab.
  5. Select the script file in the Pre/Post Script Settings drop-down list and then submit the job.
  6. Click Activity Log and verify that the script is executed to the specified backup job.

    The script is executed.

The pre/post scripts are successfully created and placed in the prepost folder.