Command Assistant enables routine O&M tasks on simple application servers, such as running automated O&M scripts, polling processes, resetting user passwords, installing or uninstalling software, updating applications, and installing patches. The Cloud Assistant commands can be batch or PowerShell commands for Windows servers and shell commands for Linux servers. You can specify custom parameters as variables in commands.
Usage notes
The maximum size of a Base64-encoded command is 18 KB.
Procedure
Log on to the Simple Application Server console.
In the left-side navigation pane, click Command Assistant.
On the My Commands tab, click Create Command.
In the Create Command panel, configure parameters as instructed.
The following table describes the parameters.
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
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.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 Use Parameters, you must enter values of the parameters in the Command Parameters field.NoteYou can specify 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.
Command Description
The description of the command.
We recommend that you enter information such as the purpose of the command to facilitate subsequent management and maintenance.
Execution Path
The working path of the command. You can specify a value for the parameter. 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).
Click Create Command.
Related operations
After you create a command, you can view the command, clone the command, and delete the command.
Operation | Description | Procedure |
View a command | After you create a command, you can view the details of the command. |
|
Clone a command | You can quickly create new commands by modifying the parameter settings of existing commands. |
|
Delete a command | If you no longer require a command, you can manually delete the command. |
|
Common commands
In this topic, common Linux shell commands are used to describe how to perform specific operations on a server, as shown in the following table.
Custom parameters in a command make the command applicable to more scenarios. In the following sample commands, the parameters in the {{key}} format are custom parameters. When you run the commands, turn on Use Parameters and enter the values of the custom parameters in the Command Parameters field.
Operation | Sample command |
Change the logon password of a server | Run one of the following commands based on the operating system of your server:
Note
|
Add, remove, or modify user information |
|
Enable or disable a firewall, and view the status of a firewall |
|
Install software Note In this example, NGINX is installed on the CentOS 7 operating system. |
|
Install CloudMonitor Note For more information, see Install and uninstall the CloudMonitor agent for C++. |
Important Replace |
View the system configurations of a server |
|
What to do next
After you create a command, you can run the command on a specified server on the My Commands tab. For more information, see Run a command.