Triggers

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.
Friendly name:A user friendly name for this trigger.
Executable path: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
Parameters: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
Expires in:Number of days this trigger should expire. A -1 means it will never expire.
File path: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.
File name:Refers to the file name that will execute this trigger. The value $ANY_FILE_NAME$ will cause this trigger to run for every file.
User LoginLogin ID of a user that triggers this rule. Specify $ANY_USER$ to trigger this rule for every user.
Event typeThe type of event that should trigger this rule. If none of the check boxes are selected, this trigger is considered disabled.

Example 1

You want to create a log file whenever John.Doe@partner.com either uploads or downloads a file.
Friendly name:Logging for John Doe
Executable path:C:\scripts\send2log.cmd
Parameters:$CUR_DATETIME, $CLIENT_IP, $FILE_NAME, $USER_ID
Expires in:-1
File path:$ANY_PATH$
File name:$ANY_FILE_NAME$
User login:john.doe@partner.com
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 184.45.14.45 C:\SharedFiles\SomeFile.pdf john.doe@partner.com

Example 2

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
Parameters:$FILE_NAME, $USER_ID
Expires in:-1
File path:C:\Incoming\invoices
File name:Invoice*.pdf
User login:$ANY_USER$
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 john.doe@partner.com

Navigation

Social Media

Powered by 10MinutesWeb.com