Execute Built-ins¶
Execute Built-ins execute commands on a remote host using SSH. Analysis can then be performed on the returned result.
Execute Command ¶
Syntax
1 2 | <result sshCommandResult> := execute(<host String>, <command String>, <timeoutInMilliseconds Number>) |
Returns
The result of the execution.
Parameters
-
host - The name of the remote host
- It can be an IP address or a host name
-
command - The shell command being executed
-
timeoutInMilliseconds (Optional) - The timeout value in milliseconds
- Default value is set to
120000
(120 seconds)
- Default value is set to
Example
1 | abc := execute("myRemoteHost", "ls -l", 6000) |
Get Exit Status ¶
Gets the exit status of the executed command.
Syntax
1 | <exitStatus Number> := <sshCommandResultult sshCommandResult>.getExitStatus() |
Returns
0
if the execution is successful, or a non-zero value if unsuccessful.
Parameter
- sshCommandResult - The result of the executed command
Example
1 2 | abc := execute("myRemoteHost", "ls -l") exitCode := abc.getExitStatus() |
Get Error ¶
Gets the execute command's error.
Syntax
1 | <error String> := <sshCommandResultult sshCommandResult>.getError() |
Returns
Output of standard error if an error occurred.
Parameter
- sshCommandResult - The result of the executed command
Example
1 2 | abc := execute("myRemoteHost", "ls -l") errorMsg := abc.getError() |
Get Output ¶
Gets the output of the executed command.
Syntax
1 | <output String> := <sshCommandResultult sshCommandResult>.getOutput() |
Returns
The output of the executed command.
Parameter
- sshCommandResult - The result of the executed command
Example
1 2 | abc := execute("myRemoteHost", "ls -l") output := abc.getOutput() |