Help Center

Scripts


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 is not supported directly. As an option either add the commands to a .ps script and execute it with "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.

The simplest examples are illustrated below: 

1) 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" 

50.png

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: "C:\some location\filename".

2) 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:
./launch.py

51.png

Note, that 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: /home/admin/launch.py.

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.

52.png

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. 
 

 

Was the article helpful? Yes / No, send feedback on article Thanks!


Please note that we won't mail you back. This is just purely feedback on the article above. If you need help from our Support Team, please use the "Contact Support" link at the top of the page.