Pre-processes and Post-processes - Commands and Arguments

When entering a Pre-process command or Post-process 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.

You can use spaces in commands and arguments provided they begin with an opening quotation mark and end with a closing quotation mark.

Examples

  • Windows

    • "c:\program files\test file\pre.bat"

    • "c:\program files\test file\pre.bat" "test set"

    • "c:\program files\test file\pre.bat" "one arg" "two arg"

  • UNIX

    • "/root/space cmd.sh"

    • "/root/space cmd.sh" "one arg"

    • "/root/space cmd.sh" "one arg" "two arg"

For Windows, a pre-process command or post-process command that is a batch file needs to be run using the command interpreter cmd.exe /C.

Example: "C:\program files\pre.bat" "test set"

Additional Arguments

In addition to the specified pre-process commands and Post-process commands, the CommServe sends additional arguments and appends them to the pre-process commands or post-process 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 within pre-process or post-process batch files or scripts to run specific operations based on the level, number of attempts, or status of the job (for example, for UNIX by issuing an echo command or including a case statement within the appropriate script).

Note: You can prevent the additional arguments from being appended to the pre-process commands or post-process commands by adding /suppress to the end of the command, for example: "c:\program files\test file\pre.bat" "arg one" "arg two" /suppress.

These arguments include the following:

Argument

Description

Possible Values

--bkplevel

A number representing the type of backup.

  • 1, agent full backups or DataArchiver level that creates a new index

  • 2, incremental backup or DataArchiver level that appends to existing data

  • 4, differential backup or DB2 agent delta backup

  • 1024, selective offline full backup

  • 2048, snapshot QR volume

  • 8192, update QR volume

  • No argument is passed for Synthetic Full Backups because the client is not involved with this backup type.

-attempt

The number of attempts for a pre-process and post-process within a given job. There is always at least one attempt.

For example, if you want to run a pre-process and post-process on only the first time the job is attempted, you can test the value of the attempt argument received by the pre-process or post-process and take the appropriate action.

Any number greater than one.

-status

A number representing the status of the phase that preceded a post-process within a job. This value is passed to all post-processes, but not pre-processes.

For example, if you want to run a post-process only if the preceding phase was a success, you can test the value of the status argument received by the post-process and take the appropriate action. If there are no custom parameters, then the status is the sixth parameter sent to the post process. If there are additional parameters, then the system parameters are appended to the end of the custom parameters (if there are two custom parameters, then status would be the eighth parameter).

With no additional parameters, the scenario described in this example can be handled in a Windows batch file as follows:

IF %6==1 ( echo "Backup Phase succeeded" >> C:\postBackup.log
)ELSE IF %6==2 ( echo "Backup Phase failed" >> C:\postBackup.log
)

An example for a Linux shell file is given below:

If [ $6 -eq 1 ] then echo "Backup Phase succeeded" >> /tmp/postbackup.log
else echo "Backup Phase Failed" >> /tmp/postbackup.log
fi

1, the phase succeeded

2, the phase failed

3, the phase succeeded with one or more errors

4, the job was killed

-job

The job ID number received from Job Manager.

The number representing the ID of a job.

Loading...