Setting Up Pre/Post Processing

Your Aspera server can execute a batch script from a pre-defined location:

C:\Program Files[ (x86)]\Aspera\Point-to-Point\var

The script is executed as a result of four transfer events:

The aspera-prepost.bat script can also execute additional batch scripts, Perl scripts, native executables, and Java programs. Aspera sets several environment variables for aspera-prepost.bat that you can use in your own custom scripts. These environment variables are described in detail in Pre/Post Variables. Depending on usage, pre- and post-processing may consume a large amount of system resources. Be sure to evaluate your system performance and apply this feature appropriately.

CAUTION:
When creating pre- and post-processing scripts, unsafe scripts can compromise a server. As with CGI scripts, you should take precautions in testing a pre/post script before placing it into use (such as taint checking and ensuring proper quotes). You should also be aware of user permissions; pre/post scripts run as the user who authenticates the transfer. To prevent a pre/post script from performing an action with elevated or special user permissions, the script needs to check the $USER variable.

Follow the steps below to set up pre/post processing for your Aspera transfer product:

  1. Install Perl-script Support (Optional)
    Pre- and post-processing supports the Perl programming language. In a Command Prompt window (Start menu > All Programs > Accessories > Command Prompt), run the following command to verify whether Perl is supported on your system:
    > perl -v

    If Perl is supported by your system, a confirmation message with the Perl version is output. If Perl is not supported, and you want to use Perl scripts in your pre/post processing, you can download and install Active Perl from the following link: http://www.activestate.com/store/activeperl/download/.

  2. Set up the batch script file.
    Locate the following file:
    C:\Program Files[ (x86)]\Aspera\Point-to-Point\var\aspera-prepost-email.bat
    Important: This file runs the perl script aspera-notif.pl, which is an email notification script that sends email messages (according to user-defined filters) to recipients. Filters and lists are defined in the Aspera configuration file aspera.conf, located in \Aspera\Point-to-Point\etc.

    Copy the contents of aspera-prepost-email.bat into a new file, and name it as follows:

    aspera-prepost.bat
  3. Create your scripts.
    The pre/post processing script, aspera-prepost.bat, can contain the pre/post processing steps, as well as execute other programs (including other .bat scripts). Often, aspera-prepost.bat checks for certain conditions (based on environment variables), and then calls a specific external executable based on those conditions. aspera-prepost.bat is executed as a result of a the start and end of a transfer session, as well as the start and end of the transfer of an individual file in the session. You can use the variables TYPE and STARTSTOP to specify a particular state. For the complete list of all variables, see Pre/Post Variables.
  4. Include custom scripts in aspera-prepost.bat.
    As a best practice, store your custom scripts in the following directory:
    C:\Program Files[ (x86)]\Aspera\Point-to-Point\custom

    When you create custom scripts, move them into the suggested directory and add the scripts (as commands) to the file aspera-prepost.bat. For example, to add the custom script script1.pl to your pre/post script, insert the following line (into aspera-prepost.bat):

    ...
    C:\Perl\bin\perl.exe  ..\custom\script1.pl
    ...