Scripts/Email

The "Scripts/Email" section is used to call a program, script, or email alert during a certain phase of a job run.

  1. Pre Analyze
  2. Analyze no Sync
  3. Post Sync
  4. Sending emails
  5. Calling programs
  6. Script examples

Pre Analyze

If the field is not empty, then take the action specified just before Analyze begins.

If the called program returns a non-zero return code or fails, do not start analyzing.

If the called program succeeds and returns a zero return code, proceed with the analysis.

Screenshot highlighting the 'Pre Analyze' field in the 'Scripts' section of the Job Options

Analyze no Sync

If the field is not empty, take the action specified just after Analyze finishes.

NOTE: The action is taken only if Analyze finishes with no changes.

Screenshot highlighting the 'Analyze no Sync' field in the 'Scripts' section of the Job Options

Post Sync

If the field is not empty, take the action specified just after Sync finishes.

Screenshot highlighting the 'Post Sync' field in the 'Scripts' section of the Job Options

Sending emails

If the value of a script field contains the "@" symbol, GoodSync sends an e-mail to the address(es) specified in the option. 

Multiple email addresses must be separated by a comma or semicolon:
user1@server.com; user2@hotmail.com

If only email addresses are specified in the field(s), a default email text is sent. To specify custom emails, you may prepend command(s) with some of the following options: 

Illustrating command prefixes and examples of sending emails using the Scripts feature in GoodSync

Example:
noattach: user@example.com: Synced %SYNCOK% items, changed items were %CHANGED% 

Here, "noattach" specifies that a sync log will not be attached to the email. The email will be sent to user@example.com and contain parameters %SYNCOK% (number of files/folders synced OK) and %CHANGED% (number of changed items synced OK).

NOTE: Before sending emails using Scripts, ensure your SMTP server settings are properly configured.

Calling programs

If the value of a script field contains no "@", GoodSync runs the program specified in the option and arguments passed to this program:
program-name %ARG1% %ARG2% %ARG3% ...
where arguments can be one of the following (all variable names are case-sensitive):

%JOBNAME% Job name
%RESULT% Result: "" for OK or "terminal error message"
%LOGPATH% Log file path in "..."
%LF% Left folder path in "..."
%LF_ACT% Resolved (=VolumeName\folder -> f:\folder) Left folder path in "..."
%RF% Right folder path in "..."
%RF_ACT% Resolved (=VolumeName\folder -> f:\folder) Right folder path in "..."
%CHANGED% Number of Changed Items in Post-Analyze
%ERRORS% Number of Errors in Post-Analyze or Post-Sync
%CONFLICTS% Number of Conflicts in Post-Analyze or Post-Sync
%SYNCOK% Number of Synced-OK items in Post-Sync
%TSTART% The time when the Job started
%TFINISH% The time when the Job finished
%TELAPSED% Elapsed Job time, in minutes, from Start to Finish

NOTE: Please use absolute paths to point to the location of the program or script. If the program name contains spaces, it must be enclosed in double quotes like so:
"C:\Documents and Settings\John Smith\My Documents\myscript.vbs"

If a script or email alert is prefixed with "errors:", it is started only if:

  • Terminal errors occurred in Analyze or Sync, OR
  • Non-terminal errors occurred in Analyze or sync, OR
  • Conflicts occurred in Analyze.

Script examples

Call Notepad to show the log file after Sync completes:
notepad %LOGPATH%

Example of how to call Notepad to display the log file after the Sync completes

Execute a batch script and pass the Left sync folder path to it as an argument before Analyze:
C:\MyScripts\Script.bat %LF_ACT%

Example of how to execute a batch script and pass the Left sync folder path as an argument before the Analyze

Send an email alert to user@example.com if any errors occur during synchronization. Do not attach the log file:
noattach: errors: user@example.com

Example of how to send an email alert without attaching the log if errors occur during synchronization

Send an email containing the Job name and any conflicts detected during Analyze to user@example.com. Additionally, attach the log file to the email:
errors: user@example.com: Conflicts detected in %JOBNAME%, %CONFLICTS%

Example of how to send an email that includes the Job name and any conflicts detected during the Analyze along with the log file attached

Run the Job named "Job Name" after the current Job is finished:
"C:\Program Files\Siber Systems\GoodSync\GoodSync.exe" job "Job Name" /sync

You can use this script to run Jobs sequentially.

Example of how to run jobs sequentially using Scripts in GoodSync

Return to top