Command Assistant is an automated O&M tool for Simple Application Server that lets you run Shell, PowerShell, and Bat commands on your servers directly from the console without logging in.
Prerequisites
-
The Simple Application Server server must be in the Running state.
-
The Cloud Assistant Agent is installed. The Cloud Assistant Agent is installed by default on Simple Application Server instances. If you have manually uninstalled the agent, you must reinstall it. For more information, see Install Cloud Assistant Agent.
Procedure
Run on a single server
-
Go to the Servers page in the Simple Application Server console.
-
On the target server's card, click the server ID to open the overview page.
NoteIf you have many servers, you can filter them by public IP address or server ID in the search box.
-
Click the Command Assistant tab.
-
On the Command Assistant page, click Run Command.
Configure the following parameters.
Parameter
Description
Command Name
Enter a name for the command.
Command Type
Select a command type.
-
Linux servers support the Shell command type.
-
Windows servers support the Bat and PowerShell command types.
Command Source
Select a source for the command:
-
Enter Command Content: Manually enter the command content. This topic uses this option as an example.
-
Select My Commands: Select a previously saved command.
-
Select Common Commands: Select a predefined command from Alibaba Cloud for common O&M tasks, such as resetting a server password or viewing top memory-consuming processes.
Command
If you set Command Source to Enter Command Content, you must enter the command content,
You can enter a command in one of the following ways:
-
Manual input: Enter a command, such as the Shell command ifconfig -s, to view brief information about the server's network interface cards.
-
Using AI Command Assistant: Press
Ctrl+Ior right-click to open the AI Command Assistant. Enter a description of the task, pressEnter, and then click Insert Command.For example, if you enter "how to check the current system time", the AI Command Assistant returns the corresponding shell command
dateand a description of its function.
You can also use the
{{key}}format in the command content to create a custom parameter, such as {{parameterName}}, and enter its value, such asls -la /etc/profile, in the Command Parameters field.You can create up to 20 parameters. Parameter names must contain only letters and digits, cannot be empty, and can be up to 64 characters long.
For more command examples, see Common commands.
Used Parameters
Select to use custom parameters.
If you enable Used Parameters, set custom parameters in the Command field in the
{{key}}format, and enter the values for the parameters in the Command Parameters field.Username
The user account on the server that runs the command. We recommend that you use a standard user to minimize security risks.
By default, commands are run as the
rootuser on Linux servers and as thesystemuser on Windows servers.Execution Path
The working directory where the command is run. The default directories are:
-
For Linux instances, the default working directory is the /root directory of the root user.
-
For Windows instances, the working directory is C:\Windows\system32 by default.
Timeout Period
The maximum time allowed for the command to run. If the command exceeds this timeout, Command Assistant terminates it.
Unit: seconds. Default: 60. Range: 10 to 86,400 (24 hours).
-
-
After you configure the parameters, click OK.
-
In the Actions column for the target command, click View Command Details to view the execution result.
The execution details include the execution ID, status, execution time, command type, result, and command content.
Run on multiple servers
-
Go to the Command Assistant page in the Simple Application Server console.
-
Choose to run a command from your saved commands or common commands.
-
On the My Commands tab, find the desired command and click Run in the Actions column.
-
Click the Common Commands tab. On the desired command card, click Run.
-
-
In the Run Command panel, configure the parameters and click Run.
-
In the Command Information section, view the command content, set command parameters, and specify the run-as user.
-
In the Select Instance section, select the target servers.
-
-
View the command execution result.
-
Click the Execution Result tab to view basic information about the command, including the execution ID, status, and command type.
-
In the Actions column of the target command, click View.
-
On the Instances tab, click the
icon to view the command execution results.The execution status is Execution Succeeded, the ExitCode is
0, and the command output isfile-20240228133835.
-
Related operations
After you run a command, you can re-run it or export its execution information.
|
Actions |
Description |
Steps |
|
Re-run a command |
If an instance or the Cloud Assistant Agent is in an abnormal state, the command fails to run. After you resolve the issue, you can run the command again. |
|
|
Export command information |
You can export the details of a command execution. |
|