Executable tasks

The executable task is included in the HCL Universal Orchestrator installation and it enables you to create executable tasks in the Graphical Designer.

An executable task runs scripts or commands with advanced options, such as redirecting standard input and standard output to a file.

A description of the task properties and valid values are detailed in the context-sensitive help in the UI by selecting the fields of the properties panel that appears on the right.

This section describes the required and optional attributes for executable tasks. Each task definition has the following format and arguments:
Table 1. Required and optional attributes for the definition of an executable task.
Attribute Description/value Required
application name executable
Arguments Specify the list of arguments.
task Tasks can be either commands or scripts.

Use path to run commands, as shown in example 1.

Use script to run scripts, as shown in example 2. The script is created and ran when the task runs. You can specify the arguments in this tag, or you can type them in the value tag and call them in the script.

suffix Specify the extension for the script file you want to use to run the commands. Do not insert the "." at the begin of the extension name. By default the script is saved as script.sh in Linux and script.cmd in Windows operating system.
Environment
error You can specify a valid file name with the file path. After the task is run, this file is updated with error logs. The file does not contain any default values. If you specify a non-existent file with the file path, it gets created with error logs after the task completes its run.
input You can specify a valid path to an input file that provides necessary data a task needs when it is run. If the file does not exist, an error is displayed when the task is run.
output You can specify a valid file name with the file path. After the task is run this file is updated with output logs. The file does not contain any default values. If you specify a non-existent file with the file path, it gets created with output logs after the task completes its run.
workingDirectory You can specify the working directory. The default path is:

c:\Users\user_name

/home/user_name

credential
userName Specify a valid username, if you want to run the task as a different user other than the current one.
password Specify a valid password for the user account.
environmentVariables Specify the environment variable as a key value pair. You can add multiple key value pairs to create a specific environment to run the task.
Example:
-key: JAVA_HOME
value: C:\\Program Files\\Java\\jdk-17.0.1

Examples

  1. The following example shows a task that runs the netstat command to show detailed network status information:
    $job
    
    /LNX_AGENT#/EXECUTABLE
      TASK
        {
          "executable" : {
            "interactive" : false,
            "path" : "netstat",
            "credential" : { }
          }
        }
      RECOVERY STOP REPEATEVERY 0000
  2. The following example shows a task that pings two web sites. The address of the web sites is defined in the value tag and called in the script tag:
    $job
    
    /LNX_AGENT#/EXEC_SCRIPT
      TASK
        {
          "executable" : {
            "interactive" : false,
            "suffix" : "",
            "script" : "ping %1 ping %2",
            "credential" : {
              "arguments" : {
                "arguments" : [ {
                  "value" : "www.mysite.com"
                }, {
                  "value" : "www.yoursite.com"
                } ]
              }
            }
          }
        }
      RECOVERY STOP
  3. The following example shows a task that runs a vbs script on Windows operating systems. The file name extension is defined in the suffix attribute of the script tag:
    $job
    
    /WIN_AGENT#/EXEC_VBS
      TASK
        {
          "executable" : {
            "interactive" : false,
            "workingDirectory" : "c:\\uno",
            "suffix" : "vbs",
            "script" : "Wscript.Echo \"loremipsum\"",
            "credential" : { }
          }
        }
      RECOVERY STOP
  4. The following example shows a task that pings two web sites. The credential with username and password, environment details that includes environment variables are also set. The address of the web sites is defined in the value tag and called in the script tag:
    $job
    
    /AGENT_HCL#/EXECUTABLE
      DESCRIPTION "Display website."
      TASK
        {
          "executable" : {
            "error" : "D:\\Trial\\test\\error.log",
            "input" : "D:\\Trial\\test\\input.txt",
            "interactive" : "false",
            "output" : "D:\\Trial\\test\\output.log",
            "workingDirectory" : "c:\\",
            "suffix" : "",
            "script" : "ping %1 ping %2",
            "credential" : {
              "username" : "john",
              "password" : "{aes}F4YOmrPprYEnoi5un7FrhCYAFaRmOBuAEVqGO4zeIVvPP/CS",
              "environmentVariables" : {
                "environmentVariables" : [ {
                  "key" : "JAVA_HOME",
                  "value" : "C:\\Program Files\\Java\\jdk-17.0.1"
                }, {
                  "key" : "ANDROID_HOME",
                  "value" : "C:\\Users\\john\\AppData\\Local\\Android\\Sdk"
                } ]
              },
              "arguments" : {
                "arguments" : [ {
                  "value" : "www.site1.com"
                }, {
                  "value" : "www.site2.com"
                } ]
              }
            }
          }
        }
      RECOVERY STOP