Command Assistant runs routine O&M tasks on Simple Application Server instances, such as automated scripts, process polling, password resets, software installation, and patch updates. Supported command types include Windows PowerShell scripts, Bat batch commands, and Linux Shell scripts, with custom parameters for flexible variable values.
Limitations
The size of a Base64-encoded script cannot exceed 18 KB.
Procedure
-
Go to the Command Assistant page in the Simple Application Server console.
-
On the My Commands tab, click Create Command.
-
In the Create Command panel, configure the parameters.
The following table describes the available parameters.
Parameter
Description
Command Type
Select a command type.
-
Linux servers support the Shell command type.
-
Windows servers support the Bat and PowerShell command types.
Command Name
Enter a name for the command.
Command
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
Specify whether to enable parameters.
When you enable Used Parameters, you can define custom parameters in the Command field by using the
{{key}}format and provide their values in the Command Parameters section.NoteParameters can contain only letters and digits, must not be empty, and must be 64 characters or less.
Command description
Enter a description for the command.
A clear description helps with command management and maintenance.
Execution Path
Specify a custom execution path for the command. The default paths are as follows:
-
Linux instances: the default execution path is the
/rootdirectory of the root user. -
Windows instances: the default execution path is the
C:\Windows\system32directory.
Timeout Period
Set the timeout period for command execution on an instance. If a task exceeds this limit, Command Assistant forcibly stops it.
The value is in seconds. The default value is 60. The valid range is 10 to 86,400 (24 hours).
-
-
Click Create Command.
Related operations
After you create a command, you can view, clone, or delete it.
|
Actions |
Description |
Procedure |
|
View a command |
View the details of an existing command. |
|
|
Clone a command |
Create a new command by modifying an existing one. |
|
|
Delete a command |
Delete a command you no longer need. |
|
Common commands
The following table lists examples of common O&M tasks that use Shell commands in Linux.
Custom parameters in commands increase their reusability. In the following examples, parameters in the {{key}} format are custom parameters. To run these commands, enable Used Parameters and enter the parameter values in the Command Parameters section.
|
Task |
Example command |
|
Change the instance system password |
To change the logon password, run the appropriate command for your operating system.
Note
|
|
Add, delete, or modify user information |
|
|
Enable, disable, and check the status of the firewall |
|
|
Install software Note
This example shows how to install Nginx on a CentOS 7 operating system. |
|
|
Install the CloudMonitor agent Note
For more information, see Install and uninstall the CloudMonitor agent. |
Important
Replace |
|
View instance system configuration |
|
Next steps
After you create a command, you can run the command on specific instances from the My Commands tab. For more information, see Run a command.