PPA Actions For Platform Server Transfer Clients

Postprocessing Actions For Platform Server Transfer Clients

Postprocessing actions take place at the end of a transfer. Here are some uses for postprocessing actions:

Process a file after it has been uploaded or downloaded.
Notify a user when a file has been uploaded.
Delete, or move a file after it has been downloaded.
Notify an admin when a transfer fails.

Postprocessing actions can execute on the initiator (local) or the responder (remote). Postprocessing actions can execute based on a successful or failed transfer.

By default, postprocessing actions are synchronous; transfers will wait for the postprocessing actions to complete before the transfer completes. This applies to postprocessing actions executed locally or on a remote Platform Server for UNIX. If you want a postprocessing action to execute asynchronously (in a background), you can add an ampersand at the end of the command.

Example: ppa1:"S,L,COMMAND,sleep 10&"

Note: When a PPA is executed asynchronously, the PPA return code is not saved in the audit Log.txt record.

Preprocessing Actions for Platform Server Transfer Clients

Preprocessing actions are performed before Platform Server checks for the existence of a file. You can use preprocessing actions to perform action files such as to zip files prior to a transfer and also to override the initiator or responder file name. Up to four preprocessing and postprocessing commands can be defined.

Example:

Note: Zip a file before sending it, and unzip the file after successfully receiving the file.
LF: /tmp/mydir.zip
PPA:"P,L,COMMAND,myzip %DIR %LFILE"
PPA:"S,R,COMMAND,myunzip %DIR %LFILE"

P,L: Indicates that a preprocessing action is to be performed on the local system.

S,R: Indicates that a postprocessing action is to be performed on the remote system for a successful transfer.

Preprocessing Actions for Directory Transfers

Preprocessing actions for directory transfers can be executed in two places:

For a config.txt parameter, use the following command:

ExecPostProc: Child { Parent, Child }  #used to be RunPPAEndDirTx { N, Y }
ExecPreProc:  Child { Parent, Child }

For CLI, use the following shortcuts:

epop         or     ExecPostProc
epep         or     ExecPreProc
Note: If ExecPreProc or ExecPostProc is set to Parent, then %TRN for Dir Transfer is resolved as the transaction ID of the parent transfer. If ExecPreProc or ExecPostProc is set to Child, then %TRN for Dir Transfer is resolved as the transaction ID of the individual transfer.

On the responder side transfers, preprocessing action always runs on each transfer. Preprocessing action with override is not supported on the responder side. Parent level is useful only on the client side, only when you initiate a directory send or receive.

Transfer Retry Considerations for Preprocessing

When a transfer is retried after a recoverable error, or after the preprocessing action terminates the transfer with a destroyable error, preprocessing actions may be executed or may be bypassed. These criteria define when preprocessing actions are executed for a retried file transfer.

Initiator Transfer retry

Responder Transfer retry

Preprocessing and Postprocessing Use the Same PPA Parameters

Preprocessing and postprocessing actions share the same 4 PPA parameters.

Example:

PPA="S,L,COMMAND,PostCommand1 %lfile %lfile.%gdate.%time"
PPA="P,L,COMMAND,pre-command %lfile"
PPA="S,R,COMMAND,PostCommand2 %lfile"
PPA="F,R,COMMAND,PostCommandFailure %lfile"

The order of preprocessing action is important because the return code determines the next step.

PPA1 is processed first, then PPA2, and so on.

Examples:

Two local PPAs are defined:

cfsend .... lf:/tmp/yz/test.tar rf:'/tmp/yz/$(LocalFileName).2'
PPA1:"P,L,COMMAND,touch /tmp/yz/test.small.3"
PPA2:"P,L,COMMAND,tar -cvf /tmp/yz/test.tar /tmp/yz/test.small*"

One local preprocessing action and one remote preprocessing action:

cfsend .... lf:/tmp/yz/test.tar rf:/tmp/yzp/'$(LocalFileName).2'
PPA1:"P,L,COMMAND,tar -cvf /tmp/yz/test.tar /tmp/yz/test.small*" PPA2:"P,R,COMMAND,mkdir /tmp/yzp"

Two preprocessing actions and two postprocessing actions. Preprocessing action is requested at the parent level, postprocessing action is requested at the child level:

cfrecv .... lf:/tmp/yzz/* rf:"/tmp/yzp/*"
PPA1:"S,L,COMMAND,touch /tmp/testI.transfer.%TRN"
PPA2:"P,L,COMMAND,mkdir /tmp/testI.prep"
PPA3:"S,R,COMMAND,touch /tmp/testR.transfer.%TRN"
PPA4:"P,R,COMMAND,mkdir /tmp/testR.prep" epep:parent epop:child

Preprocessing Action with Override Option

Sometimes, you need to override certain transfer parameters (like the file name), based on a pre-PPA execution result. The override: options allow you to handle such a scenario by passing the override parameter to the PPA action app or script.

Syntax: "P,L,Command,Script.bat override:OverrideFileName CLI_for_Script.bat"

where Script.bat and CLI_for_Script.bat should be provided by a user.

where OverrideFileName should be provided and filled in by the user. OverrideFileName is used by PPA to read a list of parameters which should be overriden.

Example: Take c:\zip* , create a .zip file by using the custom zipfiles.bat script, assign the zip file name as c:\temp\I41200001.zip, and then, send the zip file using cfsend LF: parameter.

PPA="P,L,COMMAND,zipfiles.bat override:%trn.txt inzip:c:\zip* outzip:c:\temp\%trn.zip"

If the program (zipfiles.bat) sets return code to 1, it must create a file defined by the override: parameter. In this case, it is something like I41200001.txt and the content should always befield:value.

When the return code from zipfiles.bat is 1, the following CLI parameters can be overridden by the values from the override I41200001.txt file:


LF: c:\temp\%trn.zip
UDATA: ziptest

LOCALFILE:     | LFILE:    | LF: Override Value
REMOTEFILE:    | RFILE:    | RF: Override Value
USERDATA:      | UDATA:          Override Value
PROCESS:       | PR:             Override Value

Below is a sample file:

LF:/tmp/test.zip
RF:c:/temp/test.zip
UDATA:PreProcessZip
PR:ProcTest

The following criteria are checked when using the override: option:

Example: This example fits the criteria.

PPA="P,L,COMMAND,zipfiles.bat override:myfile.txt inzip:c:\zip* outzip c:\temp\%trn.zip"

Example: This example does not fit the criteria.

PPA="P,L,COMMAND,checkifile.bat %LFILE"

Each time the preprocessing action is called, it is recorded in the PCI log/message file.

Note: PCI log files contain information about security events, configuration changes, server stop/start, preprocessing overrides, and other user actions.