Scripts
Overview
Scripts allows you to store scripts in the Universal Controller database.
When a task that specifies a stored script is executed, the script is transmitted to the remote machine for execution.
Note
There is a 1MB limit on the content size of scripts, whether the content is defined in the Script Details or a uploaded from a local file system (see Uploading a Script, below).
You can use scripts with the following task types: Windows, Linux/Unix, SAP, and File Transfer (UDM scripts for UDM File Transfer tasks).
You cannot import compiled executables into Scripts. The content of scripts must be text that can be processed by some shell, script host, or command interpreter.
You can embed Universal Controller variables in the script content. Embedded variables are resolved at trigger/run time before the script is sent to an Agent.
Controller variables can be passed as parameters, but the script still has to be written to parse the variables. However, you cannot pass variables as parameters that contain data longer than the parameter field (for example, SQL results).
For example, the following script shows how a Controller variable could be used.
#!/bin/bash
echo Task Name: ${ops_task_name}
echo Task Instance: ${ops_task_id}
Note
You also can enter a script directly into a Universal Template, but you cannot select a stored script.
Types of Scripts
There are five types of scripts:
Script | For use in Windows or Linux/Unix tasks. |
|---|---|
SAP Definition | For use in SAP tasks. |
UDM Script | For use in UDM File Transfer tasks. |
Web Service Payload | For use in Web Service tasks. |
Data | For use in a script or task (see Data Scripts, below). |
Data Scripts
Data Scripts (Script Type = Data) are meant to be used with scripts and commands specified in tasks, and resolved when the script or command is executed. Data Scripts provide the script or command with access to a path on the UAG file system where the temporary Data Script content resides.
Note
Deleting a Data script is prohibited if it is referenced by one or more Universal Tasks or Universal Template Fields (Default Value).
Changing the type for a Data script is prohibited if it is referenced by one or more Universal Tasks or Universal Template Fields (Default Value).
The Tasks tab on the Script Details is enabled for Data scripts and lists Universal Tasks that reference the script via a mapped Script field.
Using Data Scripts in a Script
To use a Data Script with a script, embed the Data Script in any of the following:
Content of a Script specified in the Script field in a Linux/Unix or Windows task.
Content of a Data Script.
Universal Template Script (Script, Linux/Unix Script, or Windows Script field).
Using Data Scripts in a Task
To use a Data Script with a task, embed the Data Script in any of the following:
Command field in a Linux/Unix or Windows task
Parameters field in a Linux/Unix or Windows task
Note
Although you can embed a Data Script in the Command field or Parameters field of a Linux/Unix or Windows task, only scripts with Script Type = Script can be referenced in a Linux/Unix or Windows task; that is, it is the only type of script that is available for selection in the Linux/Unix or Windows task Script field.
Embedding a Data Script
To embed a Data Script, use the following Script Function:
Name | Description | Syntax |
|---|---|---|
Used for embedding the path to a Data Script. |
|
Note
_scriptPath requires Agent 6.4.0.0 or later.