Top
Systemwalker Runbook Automation Reference Guide
Systemwalker

3.2.1 Execute arbitrary command

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

(1) hostname

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.

(2) commandline

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

(1) connectiontype

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.

(2) accport

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.

(3) ostype

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.

(4) username

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.

(5) password

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.

(6) execusername

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.

(7) execpassword

This operation component does not use the value of "execpassword". The value of "execpassword" is ignored even if specified.

(8) timeout

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.

(9) retry

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

(10) retry_interval

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