Introduction to Event Rules

Event Rules are based on a simple premise: an Event occurs that triggers an Action. Beyond that, you can specify Conditions that must exist before an Action is taken or that change the Action that is taken. For example, suppose you have a folder in which customers can drop files. You can set up an Event Rule that monitors that folder, and when someone puts a file into that folder, EFT Server will encrypt that file, move it into another folder, perhaps a safer location, and then send e-mails to anyone you specify informing them that a file has been moved. You can also set up a Rule that only moves particular files. For example, you can configure the Rule to move only the files with "Important" in the name, or you can route particular files to different folders.

Event Rules consist of triggering Events, any optional Conditions affecting the Event Rule, and the resulting Actions that are carried out. You can modify your Rules any time in the administration interface.

icon_info.gif

While you can have two administrators working on Event Rules at the same time, if they are working on the same Rule at the same time, when they save their Rule, the second administrator to save will get a notice that the changes could not be saved because the system changed underneath them. They then need to refresh to see the other changes, and then make their changes to the Rule again

Sample Logic

You can easily create complex programmatic events using EFT Server’s Event Rules. The Event Rule system contains objects that you simply click to add to the Rule builder, then click in the Rule to modify parameters and add variables. Below are some examples of logic you can create (in pseudo code).

("ON FILE UPLOAD" is the Event, the "if" statements are Conditions, and the "PGP," "UNZIP," "MOVE," and "SEND NOTIFICATION" are the resulting Actions.)

Always run an Action if an Event occurs:

ON FILE UPLOAD

{

      PGP Encrypt %FS.PATH%

}

 

Conditionally run an Action if an Event occurs (IF-THEN statement):

ON FILE UPLOAD

{

    if ( %FS.FILE_NAME% = "*.pgp" )

   {

      PGP Decrypt %FS.PATH%

   }

}

Multiple IF-THEN statements (if something, do this; if something else, do that):

ON FILE UPLOAD

{

   if ( %FS.FILE_NAME% = "*.pgp" )

   {

      PGP Decrypt %FS.PATH%

   }

   if ( %FS.FILE_NAME% = "*.zip" )

   {

      UNZIP %FS.PATH% to "%FS.PATH%\%EVENT.DATE%_%EVENT.TIME%\"

   }

}

Else statements (if preceding Condition is not met, do something):

ON FILE UPLOAD

{

   if ( %FS.FILE_NAME% = "*.pgp" )

   {

      PGP Decrypt %FS.PATH%

   }

   if ( %FS.FILE_NAME% = "*.zip" )

   {

      UNZIP %FS.PATH% to "%FS.PATH%\%EVENT.DATE%_%EVENT.TIME%\"

   }

   else

   {

      MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATE%_%EVENT.TIME%\"

   }

}

Run always Action (Action that will always run when the Event occurs even if preceding IF-THEN-ELSE statements are true):

ON FILE UPLOAD

{

   if ( %FS.FILE_NAME% = "*.pgp" )

   {

      PGP Decrypt %FS.PATH%

   }

   else

   {

      MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATE%_%EVENT.TIME%\"

   }

  MOVE "%FS.PATH%\%EVENT.DATE%_%EVENT.TIME%\*.*" to https://somehost/%USER.LOGON%/

  SEND NOTIFICATION e-mail TO %user.email%

}

Run the same Action more than once:

ON FILE UPLOAD

{

   SEND NOTIFICATION e-mail TO serveradmin@globalscape.com

   SEND NOTIFICATION e-mail TO %user.email%

}

Create compound conditional statements supporting AND and OR logical operators:

ON FILE UPLOAD

{

    if ( %FS.FILE_NAME% = "*.pgp" ) || ( %FS.FILE_NAME% = "*.encrypted" )

   {

      PGP Decrypt %FS.PATH%

   }

   else

   {

      MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATE%_%EVENT.TIME%\"

   }

  SEND NOTIFICATION e-mail TO %user.email%

}

 

icon_warning.gif

It is possible to configure Event Rules that create infinitely recursive cycles. Since all Event Rules operate synchronously, a file upload Event cannot be completed until all corresponding Event Actions are finished. This could lead to unpredictable server behavior due to conflicts with shared access to the same files or deleting open files. Be careful not to create circumstances where such recursive cycles might occur. For file upload Events, recursive cycles are not typical. It is recommended that you move files on the same server using the filesystem - not FTP.