Your Aspera server executes a shell script at a pre-defined location.
/Library/Aspera/var/
This script 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
aspera-prepost can also execute additional shell scripts, Perl scripts, native
executables and Java programs. Aspera sets several environment variables for
aspera-prepost, 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.
IMPORTANT NOTE: 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.
-
Set up the shell script file
Locate the following file:
/Library/Aspera/var/aspera-prepost.disable
This file runs the perl script "aspera-notif.pl."
aspera-notif.pl is an email notification script that
sends emails (according to user-defined filters) to one or more recipients.
Filters and lists are defined in the Aspera configuration file
aspera.conf, which is located in /Library/Aspera/etc/.
Copy the contents of aspera-prepost.disable into a new file, and name it as follows:
/Library/Aspera/var/aspera-prepost
Ensure that execute privileges are enabled (At least r-xr-xr-x):
-
Create your scripts
The pre/post processing script, aspera-prepost, can contain the pre/post processing steps, as well as execute other programs (including other .bat scripts). Often, aspera-prepost checks for certain conditions (based on the environment variables) and then calls a specific external executable based on those conditions. Recall that aspera-prepost 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.
-
Include custom shell scripts in aspera-prepost
Custom scripts can be written directly into the file aspera-prepost. For example, to add the custom script "script1.pl" to your pre/post script, insert the following line (into aspera-prepost):
...
perl script1.pl
...