Setting default pre/post commands

You can set defaults for the commands you want to run before or after all backup and restore jobs. If the default options are not appropriate for a particular job, you can override the default options when you create the job.

Conditions that you can set for these commands include the following:

If it is critical that the job not run if the pre-command fails, then configure Backup Exec to check the return codes of the pre- and post-commands to determine if the pre-command failed or completed successfully.

For example, if a pre-command that shuts down a database before a backup is run fails, the database could be corrupted when the backup is run. In this situation, it is critical that the backup job not run if the pre-command fails.

Additionally, if Backup Exec is configured to check the return codes of the pre- and post-commands, and the post-command returns a non-zero code, the job log reports that the post-command failed. If you also selected to run the job only if the pre-command is successful, and both the pre-command and the job ran successfully, Backup Exec will mark the job as failed if the post-command fails.

For example, if the pre-command runs successfully and shuts down the database and the backup job also runs successfully, but the post-command cannot restart the database, Backup Exec marks the job and the post-command as failed.

If you select the option On each server backed up, the pre- and post-commands are run and completed for each server before processing begins on the next selected server.

To set default pre/post commands

  1. On the Tools menu, click Options.

  2. On the Properties pane, under Job Defaults, click Pre/Post Commands.

  3. Select the appropriate options as follows:

    Allow pre- and post-commands to be successful only if completed with a return code of zero

    Select this option to allow Backup Exec to check the return codes of the pre- and post-commands to determine if they completed successfully.

    An exit code of zero returned to the operating system by the pre- or post-command is interpreted by Backup Exec to mean the job completed successfully. A non-zero exit code is interpreted by Backup Exec to mean the job ended with an error.

    After checking the return codes, Backup Exec continues processing according to selections you made for running the pre- and post-commands.

    If this option is not selected, the success of the pre- and post-commands is not determined based on the return code.

    Run job only if pre-command is successful

    Select this option to run the backup or restore job only if the pre-command is successful. If the pre-command fails, the job does not run, and is marked as failed.

    If it is critical that the job not run if the pre-command fails, then select Allow pre- and post-commands to be successful only if completed with a return code of zero. If a non-zero code is returned, it is interpreted by Backup Exec to mean that the pre-command did not run successfully. The job is not run and the job status is marked as Failed.

    Run post-command only if pre-command is successful

    Select this option to run the post-command only if the pre-command is successful.

    If it is critical that the post-command fail if the pre-command fails, then select Allow pre- and post job commands to be successful only if completed with a return code of zero. If a non-zero code is returned for the pre-command, it is interpreted by Backup Exec to mean that the pre-command did not run successfully. The post-command is not run.

    If you also select Run job only if pre-command is successful, and both the pre-command and the job are successful, but the post-command returns a non-zero code, the job log reports both the job and the post-command as failed.

    Run post-command even if job fails

    Select this option if it is critical to run the post-command regardless if the job is successful or not.

    If you also select Allow pre- and post job commands to be successful only if completed with a return code of zero and the post-command returns a non-zero code, the job log reports the post-command as failed.

    Run post-command after job verification completes

    If you selected the Verify after backup completes option on the General backup properties dialog box, select this option to run the post-command after the verification completes.

    Cancel command if not completed within x minutes

    Select the number of minutes Backup Exec should wait before canceling a pre-job or post-command that did not complete. The default time-out is 30 minutes.

    On this media server

    Select this option to run the pre- and post-commands on this media server only.

    On each server backed up or restored to

    Select this option to run the pre- and post-commands one time on each server backed up or restored to.

    The pre- and post-command selections apply to each server independently. If you select this option, the pre- and post-commands are run and completed for each server before processing begins on the next selected server.

  4. Click OK.

More Information

Pre/post commands for backup or restore jobs