Setting Up Pre/Post

Enable the pre- and post-processing on your server.

Your Aspera server executes a batch script at a pre-defined location.

OS Version Path
32-bit Windows C:\Program Files\Aspera\Enterprise Server\var
64-bit Windows C:\Program Files (x86)\Aspera\Enterprise Server\var

This script is executed as a result of four (4) transfer events:

aspera-prepost.bat can also execute additional batch scripts, Perl scripts, native executables and Java programs. Aspera sets several environment variables for aspera-prepost.bat, as well as for you to use in your own, custom scripts. These environment variables are described in detail within the topic Pre/Post Variables. Depending on usage, pre_ and post_processing may consume a great amount of system resources. Please evaluate your own system performance and apply this feature appropriately.

CAUTION:
Please take caution in creating pre- and post-processing scripts, as an unsafe script can compromise a server. As with CGI scripts, it is recommended that you take precautions in testing a pre/post script before placing it into use (e.g., taint checking, ensuring proper quotes, etc.). Also note that a pre/post script will run as the same user who authenticates for 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. (Optional) Install Perl-script Support

    Pre- and post-processing supports the Perl programming language. In a Command Prompt window (Start menu > All Programs > Accessories > Command Prompt), use the following command to verify if Perl is supported on your system:

    > perl -v

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

  2. Set up the batch script file

    Navigate to the following directory:

    OS Version Path
    32-bit Windows C:\Program Files\Aspera\Enterprise Server\var
    64-bit Windows C:\Program Files (x86)\Aspera\Enterprise Server\var

    Locate the following file:

    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\Enterprise Server\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 the environment variables) and then calls a specific external executable based on those conditions. Recall that aspera-prepost.bat is executed as a result of four (4) transfer events:

    • Session start
    • Session end
    • Start of each individual file transfer in the session
    • End of each individual file transfer in the session

    You can use the variables TYPE and STARTSTOP to specify a particular state. For the complete list of all variables, refer to Pre/Post Variables.

  4. Include custom commands in aspera-prepost.bat

    As a best practice, store your custom scripts in the following directory:

    OS Version Path
    32-bit Windows C:\Program Files\Aspera\Enterprise Server\custom
    64-bit Windows C:\Program Files (x86)\Aspera\Enterprise Server\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
    ...