Description
This operation component executes commands on hosts.
Windows, Linux or Solaris command, and Windows PowerShell Cmdlet can be specified. Also, Batch file and Script file can be executed.
Options
Basic Options
Target host name or IP address where the operation component will be executed.
To execute the operation component on the Management Server, specify the following:
For IPv4: 'localhost' or '127.0.0.1'
For IPv6: 'localhost' or '::1'
An argument error occurs if the host name or IP address is omitted.
The maximum length of the host name or IP address is 1,024 characters. An argument error occurs if this is exceeded.
Command name and argument to be executed.
Either a full path or relative path can be used for command names and arguments. If a relative path is used, the following directory becomes the relative path reference point:
Host executing the command | Communication method | Base directory |
---|---|---|
Windows Management Server | - | <Systemwalker Runbook Automation Management Server folder>\etc\share\rbaope\work The default is C: \Fujitsu\Systemwalker\SWRBAM |
Linux Management Server | - | /etc/opt/FJSVswrbam/share/rbaope/work |
Windows Business Server | File transfer infrastructure | <Systemwalker Runbook Automation Business Server folder>\FJSVInkbs\Ink02 The default is C:\Fujitsu\Systemwalker\SWRBAA |
SSH | Home directory of connected Cygwin users (C:\cygwin\home\Administrator) | |
PowerShell | Connected user's home directory | |
Other | Connection directory for each type of communication | |
Linux Solaris Business Server | File transfer infrastructure | /opt/FJSVlnkbs/lnk02 |
Other | Connected user's home directory |
If path information is included in the commandline, specify it as stated below. If the path information is to be included in the command argument, however, follow the command specification.
Change the path's delimiter from a "\" to "/".
Enclose the path information with double-quotes.
If the Business Server is running on Windows and the connection is established using the file transfer infrastructure and the path includes percent symbols ("%"), then repeat the percent symbols twice ("%%").
Specify the extension for a command name of the extension ".bat" and ".cmd". If the extension is not specified, the action is not guaranteed.
An argument error occurs if the command name and argument are omitted.
The maximum length of the command name and argument is 8,000 characters. An argument error occurs if this is exceeded.
An error occurs if an interactive command is executed.
Specify command names and arguments to be executed as follows:
For example:
When acquiring a detailed list of the files in the specified directory:
dir "c:/work/example"
When a command name is specified by its full path:
"c:/work/example/example.bat" -a "c:/work/a.txt"
Advanced Options
This is the method used for communication with the host.
Specify "File Transfer Infrastructure", "SSH", "PowerShell", "Telnet", "RSH" or "REXEC". This option is not case sensitive.
An argument error will occur if a value other than those listed above is specified.
If the communication method was not entered, a method will be searched for and used.
"PowerShell" can also be specified if the Management Server is running on Windows. However, if the Management Server is not running on Windows, specifying "PowerShell" results in an argument error.
This is the port number used with RSH and REXEC communications for receiving the standard error output.
For RSH, port numbers from 512 through 1023 can be specified. For REXEC, port numbers from 1 through 65535 can be specified.
The specification for this option is ignored for communication methods other than RSH and REXEC.
To specify multiple values, separate each value with a comma (,). Similarly, use hyphens ("-") to specify ranges.
Up to 10 port numbers can be specified. An argument error occurs if this limit is exceeded.
If a port number is not specified, "1014-1023" is used.
OS type of the host executing the command. This option is not case sensitive.
Specify Windows, Linux or Solaris.
If the OS type is omitted, the Configuration Management Database (CMDB) will be searched based on the specified host name or IP address, and Systemwalker Runbook Automation automatically sets the acquired OS type as the value.
The maximum length of the OS type is 1,024 characters. An argument error occurs if this is exceeded.
Name of the user connecting with SSH, Windows PowerShell or Telnet to the remote executing host.
Alternatively, this is the remote host user name in rsh and rexec.
If the connected user name and password required for connection are not specified, the Configuration Management Database (CMDB) is searched based on the specified host name or IP address and Systemwalker Runbook Automation automatically sets the acquired connected user name as the value.
If the operation component connects with the file transfer infrastructure, the connected user name will be fixed at either of the following names and cannot be changed. In this case, the user name is ignored even if specified.
If the Business Server is running on Windows: SYSTEM user
If the Business Server is running on Linux or Solaris: root
The maximum length of the connected user name is 1,024 characters. Argument error occurs if this is exceeded.
Password of the user connecting with SSH or Windows PowerShell or Telnet to the remote executing host.
Alternatively, this is the remote host user password for rexec.
If the connected user name and password required for connection are not specified, the Configuration Management Database (CMDB) is searched based on the specified host name or IP address and Systemwalker Runbook Automation automatically sets the acquired connected user name as the value.
If it connects with file transfer infrastructure, the connected user password is invalid.
The maximum length of the connected user password is 1,024 characters. Argument error occurs if this is exceeded.
Name of the user executing the command on the remote executing host.
If the "execusername" and "execpassword" are not specified, the Configuration Management Database (CMDB) is searched based on the specified host name or IP address and Systemwalker Runbook Automation automatically sets the acquired administrator user as the value.
If not to register to CMDB, it is executed by name of the user connecting.
If the host specified in "hostname" is running on Windows and it connects with the file transfer infrastructure, execute the command as a SYSTEM user. In this case, the connected user name is invalid.
The maximum length of the user name is 1,024 characters. An argument error occurs if this is exceeded.
This operation component does not use the value of "execpassword". The value of "execpassword" is ignored even if specified.
This is the completion timeout (seconds) for the execution of operation components.
Values between 300 and 86400 (1 day) can be specified.
For example: When timeout is to occur every 10 minutes: 600
When the execution of the operation components is not completed even if the specified time passes, the processing of the operation components is interrupted in return value 201.
This is the retry count for the execution of operation components.
When the operation components end in return value 161, the retry count is specified. Values between 0 and 5 can be specified.
As a result of retrying, if the operation components ended by the return values other than 161, the execution of the operation components ends even if it does not reach the specified retry count. The return values of the operation components become the value executed at the end.
For example: When retries are to be performed twice: 2
This is the retry interval (seconds) for operation components.
When the operation components end in return value 161, the retry interval is specified. Values between 1 and 14400 can be specified.
For example: When retrying in 300 seconds: 300
If the specification of the timeout, retry and retry_interval is omitted, and a value beyond the limits of the above-mentioned is input, the value specified with the operation components definition file becomes effective. Refer to "2.5 Definition File for Operation Components" for details.
Return Values
Icon | Name | Return value | Description |
---|---|---|---|
Success | Values lower than 159 or higher than 240 | The command has executed successfully. This is the return value for the command. | |
Failure | 161 | Failed to execute command. Retried if a retry count has been specified. | |
178 | Executing program by command terminated abnormally. | ||
187 | Authentication failed when an attempt was made to connect to the Business Server over the network (using SSH, Windows PowerShell, Telnet, RSH, or REXEC). Alternatively, an error occurred during the processing of communications with the Business Server (file transfer infrastructure). In this case, the error code for the file transfer infrastructure is output to the execution results. Refer to "3.21 Detailed Code of File Transfer Infrastructure" for information on error codes. | ||
188 | When an operation component was performing an operation on a Business Server where an RBA Agent has not been installed, the network communications (SSH, Telnet, RSH, or REXEC) with the Business Server was closed. | ||
189 | An attempt to connect to the Business Server over the network (using SSH, Windows PowerShell, Telnet, RSH, or REXEC) failed. Alternatively, an error occurred during the processing of communications with the Business Server (file transfer infrastructure). In this case, the error code for the file transfer infrastructure is output to the execution results. Refer to "3.21 Detailed Code of File Transfer Infrastructure" for information on error codes. | ||
196 | An option that cannot be specified when the Management Server is running on Linux has been specified. | ||
197 | There is an error in the input information. | ||
200 | Execution of command terminated abnormally. | ||
- | - | 201 | Execution of operation component timed out. |
202 | The operation component was not executed. | ||
203 | Failed to execute the operation component. | ||
205 | The operation component was not executed. There is a problem with the input information specification of the operation components. | ||
206 | The operation component was not executed normally. There is a problem with the output information specification of the operation component. | ||
207 | The operation components were not executed. There is a possibility that the operation components are not registered in the Management Server. | ||
208 | The Automated Operation Process has been canceled because the Automated Operation Process was recovered while the operation component was executing. | ||
Failure | Values from 159 through 240 other than those listed above | This is the return value used by Systemwalker Runbook Automation. |
Output information
Variable | Description |
---|---|
message | This variable will be set to the following message if the command is executed successfully. The operation component was successful. If an error occurs during the processing that controls the execution of the command specified by the commandline option, this variable will be set to the content of the error as a string. |
command_stdout(*1) | This variable is set to the standard output for the command that has executed. |
command_stderr(*1) | This variable is set to the standard error output for the command that has executed. |
command_rcode | This variable is set to the return value for the command that has executed. |
returnCode | This variable is set to the return value. |
*1: If the communication method is Telnet, the standard error output is set to the command_stdout variable as well. In this case, nothing is output to the command_stderr variable.
Notes
This operation component uses File Transfer Infrastructure, SSH, Windows PowerShell, Telnet, RSH, or REXEC communication to perform its operations when specify the host name other than the Management Server. It is necessary to be able to connect at least each one. Refer to "3.16 Notes of Each Communication Method" for information on communication methods.
Note 1: If the information for the Operation Automation Server has been entered for 'hostname', SSH communication will not be used and the command will be executed within the Operation Automation Server, so follow the command's specifications.
If the Business Server is running on Windows or Linux, and in IPv6 environment, operating system is not be available with REXEC communications. For this reason, if it is specified "REXEC" in connctiontype, it becomes error of return value 189.
Refer to "3.16.7 Notes When Connected User And Executing User Are Different" for information on different connected and executing users.
If a Windows PowerShell commandlet or Windows PowerShell script is to be executed, add "powershell -command" at the beginning of the "commandline" option.
Example: Executing a commandlet for obtaining update programs with a description starting with "Security" that have already been applied
powershell -command Get-HotFix -description Security*
If scripts are executed using Windows PowerShell, the return values for the scripts can be acquired using the following specification.
Example: powershell -command $LASTEXITCODE = 0; "C:/work/example.bat" ;exit $LASTEXITCODE;
Similarly, the following specification can be used to detect exceptions that have occurred while the script was executing.
Example: powershell -command $LASTEXITCODE = 0; "C:/work/example.bat" ;exit $LASTEXITCODE;trap{if ($LASTEXITCODE -eq 0) {$error;exit 1} else {$LASTEXITCODE}}
If the "commandline" option includes symbols, the specification for Windows PowerShell dictates that the escape character (a back quote " ` ") may need to be added, depending on the symbol. Refer to the specification for Windows PowerShell for details.
Values between 159 and 240 can be set as return values in Systemwalker Runbook Automation. Return values other than those between 159 and 240, or those between 159 and 240 that are unused, are not set by Systemwalker Runbook Automation, but are values that the commands output. Investigate the command itself.
If specify the command that does not exist in commandline option, there is a case of becoming an error of the following return values.
1
127
9009
If a command to start a permanent process (such as a daemon-starting shell) is specified in the commandline option, operation components may not return even after the specified command has completed. When specifying a command like this, redirect the standard output and standard error output to a file.
Example: sample.sh > /tmp/stdout.txt 2> /tmp/stderr.txt
Command output will not be included in command_stdout and command_stderr, so refer to the redirected files to obtain this information
Confirm the return values with the Web console. Refer to "Checking the execution result of operation component" in the Systemwalker Runbook Automation Administration Guide for details.
In order to perform communication using Windows PowerShell, Windows PowerShell 2.0 or later must be installed on the Management Server as well. Refer to "3.16.3 Notes on Windows PowerShell" for details.
If a firewall function is used on the Management Server, it is necessary to allow communications from Business Servers using the port numbers specified in the "accport" option to use RSH or REXEC communications. Refer to the relevant operating system manuals for information on how to allow RSH and REXEC communications.
Use the Web console to check the return value. Refer to "Confirming the Operation Component Execution Status/Execution Results" in the Systemwalker Runbook Automation Operation Guide for details.
When the return value of 201-208 is output, the Automated Operation Process enters an abort or error state, and the error message is output to the following places.
Event log of Management Server (when the Management Server is Windows(R))
System log of Management Server (when the Management Server is Linux)
Custom message of BPMN
Confirm the message in either of the above-mentioned place, and take an appropriate action. Refer to the Systemwalker Runbook Automation Message Guide for details.