Triggers in SynaMan is a mechanism to execute a script or any custom program whenever someone either uploads or downloads a file. Consider an example where you want your accounting software to run when someone uploads a new invoice. Using triggers in SynaMan, you can execute your accounting package that will process a new invoice automatically.
This feature is only available in the Enterprise edition of SynaMan.
Adding a new trigger
To add a new trigger:
- Login using the admin account.
- Click Modify Configuration
- Click Triggers on the upper right hand side
- Click Add a new trigger
The following table describes fields when creating a trigger.
A user friendly name for this trigger.
The script or executable you want SynaMan to run when an event occurs. This MUST refer to a valid executable on the machine where SynaMan is running. For example: C:\SomeFolder\MyProgram.exe
Optionally, SynaMan can pass command line arguments to your script/executable. Multiple parameters are separated by a comma. It uses following variables:
- $FILE_NAME - Name of the file that is either downloaded or uploaded
- $CLIENT_IP - Client's IP address
- $USER_ID - User ID of the user. This is blank when someone downloads or uploads using a public link
- $CUR_DATE - Current date
- $CUR_TIME - Current time
- $CUR_DATETIME - Current date and time
Number of days this trigger should expire. A -1 means it will never expire.
Refers to the folder containing the file causing this trigger to execute. The value $ANY_PATH$ means the download or uploaded file can reside in any folder.
Refers to the file name that will execute this trigger. The value $ANY_FILE_NAME$ will cause this trigger to run for every file.
Login ID of a user that triggers this rule. Specify $ANY_USER$ to trigger this rule for every user.
The type of event that should trigger this rule. If none of the check boxes are selected, this tirgger is considered disabled.
You want to create a log file whenever John.Doe@partner.com either uploads or downloads a file.
|Friendly name:||Logging for John Doe|
|Parameters:||$CUR_DATETIME, $CLIENT_IP, $FILE_NAME, $USER_ID|
|Event type:||File uploaded and File downloaded is checked|
Assume the contents of c:\scripts\send2log.cmd is:
echo %1 %2 %3 %4 >> c:\AccessLogs\John_Doe.log
In this example, a log entry is added to C:\AccessLogs\John_Doe.log whenever John Doe uploads or downloads a file containing a line similar to:
5/31/13 10:19 AM
You want your accounting package to process an invoice when a new file starting with Invoice*.pdf is uploaded to C:\Incoming\invoices folder.
|Friendly name:||Invoice handler|
|Executable path:||C:\Program Files\Accounting\AcctMgr.exe|
|Event type:||File uploaded and File downloaded are checked|
In this example, your accounting software will be executing using the following command line:
AcctMgr.exe Invoice12345.pdf firstname.lastname@example.org