Scripts are the command that can be specified when creating/editing Distribution, Consolidation or Script jobs, on step "Triggers" (see below). Scripts can run either before job starts or after it's finished and files are delivered to destination agents. These commands and scripts shall be supported by target OS.
powershell.exe -File <script name>" or run with "
powershell -noprofile -command <command>".
Scripts allow using of variables agent tags. Admin can define them on tab AGENTS -> Edit Tags. These tags can be used in local scripts or right on the job creation page. See here for more details about using tags.
All variables shall go with prefix TAG_ (resulting in
%TAG_VARIABLE% on Windows, or
$TAG_VARIABLE on posix) in the command.
When files are delivered to a Windows workstation, they need to be moved to another location. We can specify commands:
mkdir "C:\some location"
move filename "C:\some location"
- Also, one can execute a delivered exe file either directly in the destination directory, or after being moved to a proper location as illustrated above: "
When files are delivered to a unix workstation (OS X or a Linux), one needs to execute a delivered binary, but first of all, it's necessary to ensure its executability.
Admin can prepare a python, perl or shell script with all necessary commands (like: check posix permissions, add executable attribute, if necessary add firewall rules, launch the binary itself with parameters) and then, when setting up the job, just execute the script:
- Note: by default these commands are executed from the destination folder. So the script can just be transferred by the Job together with other files. But if the scripts are already located elsewhere on the target workstations, specify full path to it:
Script execution, either successful or not, is recorded into a log. This log is available in Job details: find column "Script's logs", fetch the log and download the fetched file. If no script was specified for the agent or the script is still being executed, "Files not found" error will appear.
If the command run through till the end, agent will show a green checkmark in status. If there was a problem and command was aborted, error will be reported. In this case looking at the script log can help understanding the reason.
Triggers indicate the moment when the script will be executed. This step can be skipped.
- Before file-indexing begins:
Right after job is created, the agent will start indexing files in the specified directory. A script, triggered at this moment can "cook the files before serving", for example, re-arrange the them, add/remove new and do things alike, so that the folder is indexed and distributed in a proper manner the way you need.
- After an agent completes downloading:
The script will run on each destination agent after it finishes download. Other agents may be still downloading the files, thus it's recommended not to remove or update the distributed files with this trigger. Otherwise the file will be re-downloaded from source again. It's possible to schedule the script for the agent's local time.
- After all agents complete downloading:
As opposed to the trigger above, in this case script will run only after all destination agents finish downloading all the files. This script will also be executed on the source agent.