Command Assistant helps you quickly perform routine tasks on Simple Application Server instances. These tasks include running automated Operations and Maintenance (O&M) scripts, polling processes, resetting user logon passwords, installing or uninstalling software, updating applications, and installing patches. You can use Windows PowerShell scripts, Batch (BAT) commands, or Linux Shell scripts. The commands support custom parameters that allow you to easily set variable values.
Limits
A Base64-encoded script cannot exceed 18 KB in size.
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.
Configure the parameters as described in the following table.
Parameter
Description
Command Type
The type of the command.
Linux servers: Shell is supported.
Windows servers: Bat and PowerShell are supported.
Command Name
The name of the command.
Command Content
You can use one of the following methods to enter the command content:
Manually enter the command content. For example, you can enter the shell command ifconfig -s to view the brief information about the network interface controller (NIC) of the server.
Use AI Command Assistant: Press the
Ctrl+Icomposite key or right-click the blank area in the Command field and then Click AI Command Assistant to invoke the AI Command Assistant. Follow the on-screen instructions to enter the command content, pressEnter, and then click Insert Command.
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/profilein the Command Parameter field.You can create a maximum of 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.
Use Parameters
Specifies whether to use parameters.
If you enable Use Parameters, set custom parameters in the
{{key}}format in the Command Content field. Then, enter the values for the parameters in the Command Parameters field.NoteYou can create up to 20 parameters. Parameters can contain digits and letters. They cannot be empty strings and can be up to 64 characters long.
Command Description
Enter a description for the command.
Enter information such as the purpose of the command to make it easier to manage and maintain later.
Execution Path
You can specify a custom execution path for the command. The default paths are:
For Linux instances, the default execution path is the
/rootdirectory of the root user.For Windows instances, the default execution path is the
C:\Windows\system32directory.
Timeout
Set the timeout period for the command on the server instance. If a task that runs the command times out, Command Assistant forcefully stops the task process.
The unit is seconds. The default timeout is 60 seconds. The value can range from 10 to 86,400 seconds (24 hours).
Click Create Command.
Related operations
After you create a command, you can view, clone, or delete it.
Operation | Description | Procedure |
View a command | After you create a command, you can view its details. |
|
Clone a command | You can quickly create a new command by modifying a few parameters of an existing command. |
|
Delete a command | If you no longer need a command, you can manually delete it. |
|
Common commands
This section provides examples of common O&M commands that use Linux Shell scripts. The following table lists these commands.
Using custom parameters in a command makes it more versatile. In the following sample commands, parameters in the {{key}} format are custom parameters. To use custom parameters when you run a command, enable Use Parameters and enter the parameter values in the Command Parameters field.
Operation | Sample command |
Change the logon password of a server | Run one of the following commands to change the logon password of the instance based on the instance's 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 server system configuration |
|
What to do next
After you create a command, you can run it on one or more instances from the My Commands tab. For more information, see Run a command.
> Delete