Pre/Post Processes

Topics | How To | Support


Overview

Pre/Post Impersonation

Commands and Arguments

Pre/Post Processes Considerations


Overview

Data Protection and Recovery jobs comprise one or more sequential phases. Each phase must complete before its successor can begin. These phases can be used to trigger operations outside of the data protection or recovery process. For example, copying files from a share to your local disk and then deleting the files after the data protection operation has run, running a database integrity check prior to backing up your databases/workspaces, or deleting files to make room for the data to be restored.

For each batch file/shell script that is associated with one of a job's Pre/Post processing phases, the system examines the return code. A return code of zero indicates a successful run and the job continues. When a non-zero return code is encountered, the job will wait and restart that phase.

For jobs that are run with Pre/Post Process commands, the CommServe sends additional arguments, appending them to your Pre/Post commands. See Commands and Arguments for more information.

Pre/Post Processes for Data Protection Operations

Pre/Post Processes for Data Protection are configured in the Subclient Properties (Pre/Post Process) tab, which allows you to use the job phases as triggers to start processes. For more information on which agents support Pre/Post Processes for Data Protection, check the configuration section for your agent.

Pre/Post Processes for Data Recovery Operations

Pre/Post Processes for Data Recovery Operations are configured in the Advanced Restore Options dialog box, which allows you to use the restore phases as triggers to start processes. For more information on which agents support Pre/Post Processes for Restore, see Restore Options - Support.

Pre/Post Processes for Data Replication Activities

Pre/Post Processes for Recovery Points for ContinuousDataReplicator are configured in the Pre/Post tab of the Replication Set Properties; this allows you to execute processes either before or after the Recovery Point is created. See Create a Replication Set.

Run Post Processes for All Attempts

Under normal circumstances, a specified post process command is executed only upon the successful completion of the respective job phase, or when the job is killed or fails. However, you may still want to run a post process even if the job phase did not complete successfully, especially if your post process is used to bring a database online or release a snapshot.

The system provides you with an option to run post data protection or restore processes when the respective phase of the job is interrupted, suspended or fails in addition to successful, killed or failed jobs. For data protection operations, the Run Post <phase> Process for All Attempts option can be selected in the Subclient Properties (Pre/Post Process) tab. For restores, the Run PostRestore Process for All Attempts option is selected on the Pre/Post Processes for Restore dialog box.


Pre-Post User Impersonation for Data Protection and Recovery Operations

When using pre/post commands on a Windows client computer to execute processes before and/or after the operation, you must designate the Local System Account or, for added security, assign a Windows User Account as having permission to run these commands. This option does not apply to subclients on Unix platforms.

User Impersonation requires that the affected user have write permissions to the product installation folders; otherwise, the User Impersonation account may not take effect. This is especially true if the associated computer is not part of a domain and if the user is not a domain user.

The User Impersonation designated for data protection operations is independent of the User Impersonation account you can assign for recovery operations.

  • This option is not available for Oracle Unix iDataAgents.
  • The Image Level iDataAgent does not support user impersonation for volume level restores.

See the following as appropriate for a step-by-step procedure:


Pre/Post Process - Commands and Arguments

When entering a Pre/Post command, specify the full file path. For example, C:\users\profile.bat for Windows or /etc/pre.sh for Unix. Do not use relative paths.

The system allows the use of spaces in commands and arguments provided they begin with an opening quotation mark and end with a closing quotation mark.

Examples: "c:\program files\test file\pre.bat"
"c:\program files\test file\pre.bat" "test set"
"c:\program files\test file\pre.bat" "arg one" "arg two"
"/root/space cmd.sh"
"/root/space cmd.sh" "one arg"
"/root/space cmd.sh" two args

For Windows, a Pre/Post command that is a batch file needs to be run using the command interpreter cmd.exe /C.

Example: c:\winnt\system32\cmd.exe /C  ""c:\program files\pre.bat" "test set""

In addition to the specified Pre/Post commands, the CommServe sends additional arguments and appends them to the Pre/Post commands (if any); this can provide a useful means of control based on the type of job being run. You can use the value of the argument(s) within Pre/Post batch files or scripts to run specific operations based on the level, number of attempts, or status of the job (e.g., for Unix, by issuing an echo command or including a case statement within the appropriate script). These arguments include the following:

--bkplevel <level>   where "level" can be
'1' =  iDataAgents: Full Backup

DataArchiver Agents: Archive level that creates a new index

'2' =  iDataAgents: Incremental Backup

DataArchiver Agents: Archive level that appends the existing index

'4' =  iDataAgents: Differential Backup

DB2 iDataAgent: Delta Backup

  No argument is passed for Synthetic Full Backups because the client is not involved with this backup type.
'1024' =  Selective Offline Full Backup
'2048' =  Snapshot QR Volume
'4096' =  Create QR Volume
'8192' =  Update QR Volume
'32768' =  Selective Online Full Backup
If your agent's data protection rules allow backup levels to be changed "on-the-fly", the Job Manager will submit the new backup level to the next Pre/Post command that occurs in the job. This could result in the backup level varying among Pre/Post commands for a given job.
-attempt <n> where "n" is the number of attempts (will always be at least one) for a given Pre/Post process (not the phase) within a given job. This will be passed to all Pre and Post processes.
Example: If you want to run a Pre/Post process only the first time the job is attempted, you can test the value of the "attempt" argument received by the Pre/Post process and take the appropriate action.
-status <n> where "n" is one of the following values indicating the status of the phase that preceded a given Post process within a given job: (This will be passed to all Post processes, but not to Pre processes.)
'1' =  The phase succeeded
'2' =  The phase failed
'3' =  The phase succeeded with one or more errors
'4' =  The job was killed while executing that phase
Example: If you want to run a Post process (e.g., PostBackup) only if the preceding phase (e.g., Backup) was a success, you can test the value of the "status" argument received by the Post process and take the appropriate action.
-job <n>; where "n" is the Job ID number received from Job Manager.
-vm <virtualmachine> The vm argument is used by Pre/Post commands internally. The vm argument does not apply for Unix agents.

Use the PrePostCmdExample Utility to Prototype Batch File

The arguments can be tested in a sample batch file using the PrePostCmdExample command line utility in the Resource Pack. This utility lists the different backup level values that are passed to the batch file and shows how to parse the command line parameters in a batch file. Use this utility to prototype the actual pre-post command batch file.


Pre/Post Process Considerations

Consider the following when adding a Pre/Post Process to a job:

Pre/Post Processes for Data Protection Operations

Pre/Post Process for Data Protection and Recovery Operations

Back to Top