Command Assistant is an automated O&M tool for Simple Application Server. You can manage simple application servers by using shell, PowerShell, and batch commands in the Simple Application Server console without logging on to the servers. This topic describes how to run Command Assistant commands.
Prerequisites
The simple application server must be in the Running state.
Cloud Assistance Agent is installed on the server. By default, Cloud Assistant Agent is installed on each simple application server. If you manually uninstall Cloud Assistant Agent, you must reinstall it. For more information, see Install Cloud Assistant Agent.
Procedure
Run a command on a single server
Log on to the Simple Application Server console.
In the left-side navigation pane, click Servers.
Click the server ID in the card of the desired server to go to the Server Overview tab.
NoteIf you have multiple servers, you can enter the public IP address or ID of the server in the search box to filter the server.
Click the Command Assistant tab.
In the upper-right corner of the Command Assistant tab, click Run Command.
Configure parameters as prompted. The following table describes the parameters.
Parameter
Description
Command Name
The name of the command.
Command Type
The type of the command.
Linux servers: Shell is supported.
Windows servers: Bat and PowerShell are supported.
Command Source
The source of the command. You must specify this parameter based on your business requirements.
Enter Command Content: If no command exists, you can directly enter the parameters of the command that you want to run. In this example, Enter Command Content is selected.
Select My Commands: If you have one or more existing commands, you can select the command that you want to run from the drop-down list.
Command
The content of the command. For example, you can enter the shell command ifconfig -s to view the brief information about the network interface controller (NIC) of the server.
You can also specify custom parameters in the
{{key}}
format such as {{parameterName}} in the Command field and enter parameter values such asls -la /etc/profile
in the Command Parameter field.You can create up to 20 parameters. The parameters can contain digits and letters, and cannot be empty strings. Each parameter can be up to 64 characters in length.
For more information, see Common commands.
Used Parameters
Specifies whether to use parameters.
If you specify custom parameters in the
{{key}}
format in the Command field and turn on Used Parameters, you must enter the values of the parameters in the Command Parameters field.Username
You can specify a user of the server to run the command. We recommend that you run the command as a regular user to reduce security risks.
By default, Command Assistant commands are run by the
root
user on Linux servers and by thesystem
user on Windows servers.Execution Path
The working path of the command. You can specify a custom path. Default working paths vary based on the operating systems of the servers on which the command is run.
For Linux servers, the default working path is the /root directory of the root user.
For Windows servers, the default working path is C:\Windows\system32.
Timeout Period
The timeout period of the command. If a task that runs the command times out, Command Assistant forcefully stops the task process.
Unit: seconds. The default timeout period is 60 seconds. You can set the timeout period to a value from 10 to 86400 seconds (24 hours).
After you configure the parameters, click Run.
On the Command Assistant page, find the command that you ran and click View Task Details in the Actions column to view the details of the command running result.
The details of the command running result include the running ID, status, running time, command type, running result, and command content.
Run a command on multiple servers at the same time
Log on to the Simple Application Server console.
In the left-side navigation pane, click Command Assistant.
On the My Commands tab, find the desired command and
click Run in the Actions column.
In the Run Command page, configure parameters based on your business requirements.
In the Command Information section, configure command-related parameters and specify a user to run the command.
In the Select Servers section, select one or more servers on which you want to run the command at the same time.
Click Run.
View the command running result.
Click the Execution Result tab.
View the basic information of the command, including the execution ID, execution status, and command type.
Find the desired command and click View Details in the Actions column.
On the Instances tab, click the icon to view the command running result.
Related operations
After you run a command, you can run the command again or export the command running information.
Operation | Description | Procedure |
Re-run a command | When the server status or Command Assistant Agent status is abnormal, the command fails to be run. After you fix the status issue, you can re-run the command. |
|
Export command information | You can export the details of a command. |
|