1. Introduction
Aspera Enterprise Server allows custom actions to be executed before and after transfer sessions. The triggered actions can be executed before (pre-) and after (post-) each transfer or session. The automation's pre-post script can execute Perl scripts and shell commands. Email Notification is also part of the pre-post functionality.
2. Setting Up
To set up the Pre- and Post- processing feature of Aspera Enterprise Server, follow the instructions for your operating system:
| Platform |
Instructions |
| Windows |
- Step 1. If you are using pre-post processing to execute Perl scripts, make sure you have installed Perl on this computer. When Perl is installed, reboot the computer. The latest Perl for Windows can be found at: http://www.activestate.com/store/activeperl/download/.
- Step 2. To set up the scripts file, go to \Program Files\Aspera\FASP\varand rename the file aspera-prepost-email to aspera-prepost, append .bat if file extension is shown. The Enterprise Server executes this file when startup.
|
| Linux, Solaris, FreeBSD |
- To set up the scripts file, go to /opt/aspera/var and rename the file aspera-prepost.disable to aspera-prepost. The Enterprise Server executes this file when startup.
|
| Mac OS X |
- To set up the scripts file, go to /Library/Aspera/var and rename the file aspera-prepost.disable to aspera-prepost. The Enterprise Server executes this file when startup.
|
| Isilon |
- To set up the scripts file, go to /usr/local/aspera/var and rename the file aspera-prepost.disable to aspera-prepost. The Enterprise Server executes this file when startup.
|
3. Usage
When you have set up the pre-post processing, you can create your custom script, and include the scripts to be executed in the batch file aspera-prepost (.bat). When the script is created, for example 'the_script.pl', add the execution command in the batch file:
@perl the_script.pl
The following are the pre-defined tags for type sessions and type files. All variables can also be used in Email Notification.
| Type |
Variables |
| Both Type Session and Type File |
- TYPE = Session | File
- STARTSTOP = Start | Stop
- SESSIONID = (session id)
- USERSTR = (user string)
- STATE = started | success | failed
- ERRCODE = (error-code)
- ERRSTR = (error-string)
|
| Type Session |
- SOURCE = (source)
- TARGET = (target)
- PEER = (peer name or IP address)
- USERID = (user id)
- USER = (user name)
- DIRECTION = send | recv
- TARGETRATE = (initial target rate)
- MINRATE = (initial minimum rate)
- RATEMODE = Adaptive | Fixed
- SECURE = Yes | No
- LICENSE = (license account and seat number)
- PEERLICENSE = (peer license account and seat number)
- FILECOUNT = (number of files)
- TOTALBYTES = (total bytes transferred)
- TOTALSIZE = (total size of file set)
- FILE1 = (first file)
- FILE2 = (second file)
- FILELAST = (last file)
- TOKEN = (user defined security token)
- COOKIE = (user defined cookie string)
|
| Type File |
- DIRECTION = send | recv
- FILE = (file name)
- SIZE = (file size in bytes)
- STARTBYTE = (start byte if resumed)
- RATE = (effective rate in Mbps)
- DELAY = (measured network delay)
- LOSS = (measured network loss)
- REXREQS = (total number of retransmission requests)
- OVERHEAD = (total number of duplicate packets)
|
4. Examples
Here are some examples of the pre- and post- processing scripts:
| Examples |
|
1.
On Linux, change file and directory permissions after receiving, for transfer sessions with multiple files and subdirectories:
if [ $TYPE == "Session" ]; then
ascp -r -l 100000 space/files root@10.0.0.2:space
if [ $STARTSTOP == "Stop" ]; then
chmod -R g+rx $TARGET
fi
fi
|
|
2.
On Linux, change file and directory permissions after receiving, for transfer sessions with individual file:
if [ $TYPE == File ]; then
if [ $STARTSTOP == Stop ]; then
echo "The file is: $FILE" >> /tmp/p.log
chmod 777 $FILE
fi
fi
|
|
3.
On Windows, delete files after successful upload:
rem Delete file after successful upload
if "%TYPE%" equ "File" (
if "%STARTSTOP%" equ "Stop" (
if "%DIRECTION%" equ "send" (
if "%STATE%" equ "success" (
echo Deleting %FILE% >> delete.log
rem
rem Uncomment the following line (remove leading rem)
rem to delete files after successful transfer.
rem
rm %FILE% >> delete.log
)
)
)
)
|
|
4.
On Linux, delete files after successful uploaded to host 192.168.1.40:
if [ $TYPE == File ]; then
if [ $STARTSTOP == Stop ]; then
if [ $DIRECTION == send ]; then
if [ $PEER == 192.168.1.40 ]; then
if [ $STATE == success ]; then
logger -p local2.info "Aspera post-processing: delete file $FILE"
rm -f $FILE
else
logger -p local2.info "Aspera post-processing: file not completed: $FILE (not deleting)"
fi
fi
fi
fi
fi
|
|
5.
On Linux, Re-transfer received files to a 3rd computer:
TARGET = aspera@10.10.10.10:/tmp
RATE = 10m
export ASPERA_SCP_PASS=aspera
if [ $TYPE == File ]; then
if [ $STARTSTOP == Stop ]; then
if [ $STATE == success ]; then
if [ $DIRECTION == recv ]; then
logger -plocal2.info "Move file $FILE to $TARGET"
ascp -T -l $RATE $FILE $TARGET && rm -f $FILE
fi
fi
fi
fi
|