Runs a command on a simple application server.
Operation description
Command Assistant is an automated O&M tool designed for simple application servers. You can run commands (Shell, PowerShell, and Bat) on simple application server instances from the console for operations management without having to log on to the instances.
To use Command Assistant, the following conditions must be met:
The simple application server instance must be in the Running state.
Cloud Assistant Agent must be installed. Cloud Assistant Agent is installed on simple application server instances by default. If you manually uninstalled it, reinstall it. For more information, see Install Cloud Assistant Agent.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
swas-open:RunCommand |
create |
*Command
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| CommandContent |
string |
Yes |
The command content. Note the following items:
|
ifconfig -s |
| WorkingDir |
string |
No |
The custom execution path of the command. Default paths:
|
/root |
| RegionId |
string |
Yes |
The region ID. You can call ListRegions to query the latest region list. |
cn-hangzhou |
| Timeout |
integer |
No |
The timeout period for the command to run on the server instance. Unit: seconds. When a command execution task times out, Command Assistant forcefully terminates the task process. Valid values: 10 to 86400 (24 hours). Default value: 60. |
60 |
| Type |
string |
Yes |
The language type of the command. Valid values:
|
RunShellScript |
| EnableParameter |
boolean |
No |
Specifies whether the command contains custom parameters. Default value: false. |
false |
| Parameters |
object |
No |
The key-value pairs of custom parameters to pass in when the command contains custom parameters. For example, if the command content is The number of custom parameters ranges from 0 to 20. Note the following items:
Default value: empty, which indicates that this parameter is unset to disable custom parameters. |
{"name":"Jack", "accessKey":"LTAI****************"} |
| WorkingUser |
string |
No |
The user that you want to use to run the command on the simple application server instance. We recommend that you use a regular user to run commands to reduce security risks. Default values:
|
root |
| WindowsPasswordName |
string |
No |
The password name of the user that runs the command on a Windows instance. If you want to run a command as a non-default user (System) on a Windows instance, you must specify both WorkingUser and this parameter. To reduce the risk of password leaks, store the plaintext password in the parameter repository of CloudOps Orchestration Service and pass in only the password name here. |
axtSecretPassword |
| InstanceId |
string |
Yes |
The instance ID of the simple application server. |
ace0706b2ac4454d984295a94213**** |
| Name |
string |
Yes |
The name of the command execution. |
testName |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| InvokeId |
string |
The command execution ID. |
t-hz02p9545t6**** |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"InvokeId": "t-hz02p9545t6****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.