Pre and Post Processes - Commands and Arguments

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

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

  • 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/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""

Additional Arguments

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 within Pre/Post 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/Post 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:

--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 is passed to all Post processes, but not to Pre processes.)

Example: If you want to run a Post process (for example, PostBackup) only if the preceding phase (Backup, for example) was a success, you can test the value of the status argument received by the Post process and take the appropriate action.

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
-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.