Overview of the "Scripts" section in Job Options
The scripts tab may be used to call a program, script, or email alert during a certain phase of a job run.
Pre Analyze E-Mail or Program
If the option is not empty, then take the action specified just before Analyze begins.
If the program returns non-zero return code or fails, do not start Analyze.
If the program succeeds and returns zero return code, proceed with Analyze.
Post Analyze (No Changes) E-Mail or Program
If the option is not empty, then take the action specified just after Analyze finishes.
Action is taken only if Analyze finishes with No Changes.
Post Sync E-Mail or Program
If the option is not empty, then take the action specified just after Sync finishes.
Scripts: Sending Emails
If the Scripts option value contains the '@' symbol, then GoodSync sends e-mail to address(es) specified in the option.
Multiple email addresses must be separated by comma or semicolon: user1@server.com; user2@hotmail.com
If only emails are specified in the field(s), then default email text is sent.
To specify custom emails, you may prepend with some of the following options:
Example:
noattach: user@siber.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@siber.com, and the email will contain parameters %SYNCOK% (number of files/folders synced OK) and %CHANGED% (number of changed items synced OK).
Scripts: Calling Programs
If the Scripts option value contains no '@', then 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% | Time when Job started |
%TFINISH% | Time when Job finished |
%TELAPSED% | Elapsed Job time, in minutes, from Start to Finish |
Example: call Notepad to show log file: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"
notepad %LOGPATH%
If a script or email alert is prefixed with "errors: ", then 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.
For example, the following will send an email alert to email@domain.com if any errors occur during synchronization.