About 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:

  • Run the backup or restore job only if the pre-command is successful

  • Run the post-command only if the pre-command is successful

  • Run the post-command even if the backup or restore job fails

  • Allow Backup Exec to check the return codes (or exit codes) of the pre- and post-commands to determine if the commands 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.

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.

More Information

Setting default pre/post commands

Pre/post commands for backup or restore jobs

Running pre and post commands for restore jobs

About pre/post commands