The General Command Plug-in runs a command line on the destination host.
If you have pre-set authentication information in the Agentless Remote Connections view, you can run commands by specifying the following information in the general command plug-in:
- Device on which to run the command (destinationHost property)
- Command to run (commandLine property)
- Command arguments (commandLineParameter property)
If destination host is a Ops Center Automator Server (localhost), the user ID and the password are unnecessary.
For the command to run on the target device, specify characters that can be used in commands in the OSs of the Ops Center Automator server and the operation target device. For example, if the Ops Center Automator server and the target device both run the Windows OS with Japanese Locale, you can specify characters in the MS932 character set.
When local execution function is enabled and the OS of the local host is Windows, the command runs with System account privileges. If the OS is Linux, the command runs with root user privileges. The execution folder for the command is specified as follows:
- When the connection destination is running Windows: Admin$\Hitachi\CMALib\HAD\home Admin$ is the folder specified in the windir environment variable.
- When the connection destination is running Linux OS and true is specified for the elevatePrivileges property: The home folder of the root user
- When the connection destination is running Linux OS and false is specified for the elevatePrivileges property: The home folder of the connection user
Prerequisites
Specific commands must be installed on the OS of the target device before you use the general command plug-in.
To use the general command plug-in when the target device is running Windows, you must enable administrative sharing.
Cautionary notes
- IPv6 is not supported when Ops Center Automator is running on Linux OS and the destination host is Windows.
- The locale and character set at the for running the plug-in depend on the OS of the operation target device.
- If a task is stopped while the plug-in is running, the status of the task changes to Failed or Completed when the general command plug-in processing finishes. The status of steps and tasks after plug-in finishes running depends on the return code of the step and the condition for running subsequent steps. You can set a Subsequent-step Execution Condition in the Create Step or Edit Step dialog box.
- The execution method differs depending on the OS of the target device. The command is run by SMB and RPC in Windows, and SSH in Linux OS. Therefore, the SSH server must be set up on Linux-based operation target devices.
- The SSH port number is set in the connection-destination properties file (connection-destinationname.properties) or the properties file (config_user.properties).
- When the target device is running Windows, user profiles are not inherited. This means a plug-in can produce different results from a command or script run on the desktop. To avoid this problem, do not reference settings in user profiles, such as user environment variables and registry entries, and proxy settings, when running a plug-in. If a command or script references an element of a user profile, the command or script might not behave as expected. For example, when you run a command or script that references proxy settings, the command or script might fail with a communication error. This might occur in scenarios such as implementing a Windows Update using a script.
- If the target device is running Linux OS, and you must specify non-ASCII characters in the commandLine or commandLineParameter property, the login script setting is required in the following plug-ins:
- General Command Plug-in
- File-Transfer Plug-in
- Custom Plug-in
- Terminal Command Plug-in
Login script setting
You can check the status of the istrip setting in standard output by running the stty -a command in the command line for each plug-in. If -istrip appears in standard output, theistrip setting is disabled. If istrip is not prefixed with "-" in standard output, the istrip setting is enabled.
The following example shows "istrip" with the correct setting:
If istrip appears without the dash (-) you must edit the login script file and add the line stty -istrip.
Return codes
The General Command Plug-in generates the following return codes:
Return Code | Description |
---|---|
0-63 | The return code (0 to 63) of the command or script is returned as the return code of the plug-in. The meaning of the command or script depends on the command or script. |
64 | If the return code of the command or script is 64 or higher, 64 is returned as the return code of the plug-in. |
65 | The connection with the Ops Center Automator server failed. For example, the Ops Center Automator server might have stopped while the plug-in was running. |
66 | The following user is mapped to the Ops Center Automator user:
|
68 | No information about the target job execution ID exists. |
69 | An environment variable of the task-processing engine cannot be acquired. |
70 | The connection with the operation target device failed. |
71 | Command execution failed. |
72 | The execution status of the command cannot be acquired. |
76 | The connection timed out. |
77 | The host name of the operation target device cannot be resolved. |
78 | Authentication with the operation target device failed for one of the following reasons:
|
80 | Task execution has stopped. |
81 | The plug-in was called in a status that is not valid. |
82 | The request message from the task-processing engine cannot be correctly parsed. |
83 | The Ops Center Automator server environment is corrupted. |
84 | Information about the plug-in cannot be obtained. |
86 | The specified property value is not valid. |
127 | Another error occurred. |
Property list
The following properties are available for the General Command plug-in:
The standard output or standard error output of the commands or scripts specified in these properties are output as the standard output of the step in Ops Center Automator. However, processing for which the total standard output and standard error output of the command or script exceeds 100 KB is outside the scope of product support. Run the command or script in advance to make sure that the total standard output and standard error output does not exceed 100 KB.
If the operation target device is running Windows, the content specified in the commandLine and commandLineParameter properties are made into a batch file and run on the operation target device. Therefore, the result of this action might differ from the result if the same command and script were run from the command prompt.
If the operation target device is running Linux OS, linefeed codes in standard output and standard error output are changed as follows:
- CR(0x0d) is changed to LF(0x0a)
- CR+LF(0x0d0a) is changed to LF+LF(0x0a0a)
In addition, if the character string at the end of the standard output and standard error output is not a linefeed code (CR, LF, or CR+LF), LF(0x0a) is added to the end.
Usage example of stdoutPattern and stdoutProperty properties
By using the stdoutPattern property, you can extract the value output to standard output and store it in the stdoutProperty property. The following figure shows the data flow when specifying aaabbb(.*) in stdoutPattern1.
As defined in stdoutPattern1, for the standard output aaabbbccc, the value after aaabbb (in this case ccc) is extracted. The extracted value is stored in the stdoutProperty1 property.
Specifying the SSH port number
You can specify a port number when using SSH to connect to the operation target device. The following table describes how to specify the port number and priority of each method.
Priority | Set in | Property key | Default value |
---|---|---|---|
1 | Connection-destination properties file (connection-destination-name.properties) | ssh.port | -- |
2 | Properties file (config_user.properties) | ssh.port.number | 22 |