Configuring pre/post commands for backup jobs
You can configure commands that you want to run before or after all backup jobs. For example, you may want to create a pre-command to shut down a database before a backup job runs. You could also create a post-command that restarts the database after the job is completed.
Conditions that you can set for these commands include the following:
-
Run the backup 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 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
If the pre- or post-command returns an exit code of zero, Backup Exec considers the job to have completed successfully. Backup Exec considers any non-zero exit codes to mean that the job encountered an error.
If it is critical that the job does not run if the pre-command fails, configure Backup Exec to check the return codes. Backup Exec uses the return codes 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 runs. In this situation, it is critical that the backup job does not run if the pre-command fails.
If Backup Exec is configured to check the return codes and the post-command returns a non-zero code, the job log reports that the post-command failed. You may have also selected to run the job only if the pre-command is successful. Even if both the pre-command and the job run successfully, Backup Exec marks the job as failed if the post-command fails.
For example, the pre-command can run successfully and shut down the database. The backup job can also run successfully. But if the post-command cannot restart the database, Backup Exec marks the job and the post-command as failed in the job log.
If you select the option On each server backed up, the pre- and post-command selections apply to each server independently. The pre- and post-commands are run and completed for one server at a time before they are run on the next selected server.
You can configure pre-commands and post-commands as default settings for all backup jobs. If the default settings are not appropriate for a particular job, you can override them when you create the job. You do not have to create default settings for pre-commands and post-commands, however. If you want to use pre-commands and post-commands only for specific jobs, you can configure the settings when you create those jobs.
To configure pre/post commands for backup jobs
-
Do one of the following:
To configure default pre/post commands for all backup jobs Complete the following steps\: - Click the Backup Exec button, and then select Configuration and Settings . - Select Job Defaults , and then select the type of backup for which you want to configure default pre/post commnands. To configure pre/post commands for specific backup jobs Complete the following steps\: - Create a new backup definition or edit an existing backup definition. - In the Backup box, click Edit . -
In the left pane, click Pre/Post Commands.
-
Complete the following options:
Type a command to run before the backup runs Runs a command on the specified server before the backup job runs. Use local paths, and make sure that the paths exist on each server and are correct. Commands that require user interaction, such as prompts, are not supported. Run job only if pre-command is successful Runs the backup 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 does not run if the pre-command fails, then select Let Backup Exec check the exit codes of the commands to determine if the commands completed successfully . If a non-zero code is returned, Backup Exec interprets it to mean that the pre-command did not run successfully. The job does not run and the job status is marked as Failed. Type a command to run after the backup runs Runs a command on the specified server after the backup job runs. Use local paths, and make sure that the paths exist on each server and are correct. Commands that require user interaction, such as prompts, are not supported. Run post-command after job verification completes Runs the post-command after the verification completes, if you configured a verify operation for the job. See Configuring automatic verify operations for backup jobs . Run post-command only if pre-command is successful Runs the post-command only if the pre-command is successful. If it is critical that the post-command does not run if the pre-command fails, then select Let Backup Exec check the exit codes of the commands to determine if the commands completed successfully . If a non-zero code is returned for the pre-command, Backup Exec interprets it to mean that the pre-command did not run successfully. The post-command does 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 Runs the post-command regardless of whether the job is successful or not. If you also select Let Backup Exec check the exit codes of the commands to determine if the commands completed successfully and the post-command returns a non-zero code, the job log reports the post-command as failed. Let Backup Exec check the exit codes of the commands to determine if the commands completed successfully Lets Backup Exec check the return codes of the pre- and post-commands to determine if they completed successfully. Backup Exec interprets an exit code of zero from either the pre- or post-command to mean that the command completed successfully. Backup Exec interprets a non-zero code to mean that the command ended with an error. After Backup Exec checks the return codes, it continues processing according to the 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. On this Backup Exec server Runs the pre- and post-commands on this Backup Exec server only. On each server backed up Runs the pre- and post-commands one time on each server that is backed up. 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 Backup Exec begins processing on the next selected server. Cancel command if not completed within x minutes Designates the number of minutes Backup Exec should wait before it cancels a pre- or post-command that did not complete. The default timeout is 30 minutes. -
Click OK.
More Information
Related information