All Products
Search
Document Center

Simple Application Server:Create a command

Last Updated:Dec 26, 2025

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

  1. Go to the Command Assistant page in the Simple Application Server console.

  2. On the My Commands tab, click Create Command.

  3. 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+I composite 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, press Enter, and then click Insert Command.

      image

    You can also specify custom parameters in the {{key}} format such as {{parameterName}} in the Command field and enter parameter values such as ls -la /etc/profile in 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.

    Note

    You 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 /root directory of the root user.

    • For Windows instances, the default execution path is the C:\Windows\system32 directory.

    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).

  4. 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.

  1. In the Actions column of the target command, click View.

  2. In the Command Content panel, view the command details.

Clone a command

You can quickly create a new command by modifying a few parameters of an existing command.

  1. In the Actions column of the target command, click Clone.

  2. In the Clone Command panel, modify the parameters and click Clone Command.

Delete a command

If you no longer need a command, you can manually delete it.

  1. In the Actions column of the target command, choose image > Delete.

  2. In the Delete Command dialog box, click OK.

Common commands

This section provides examples of common O&M commands that use Linux Shell scripts. The following table lists these commands.

Note

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.

  • Linux:

    echo "root:<yourPassword>"|chpasswd
  • Windows:

    net user "Administrator" "<yourPassword>"
Note
  • Replace <yourPassword> in the command with the new password.

  • The password must be 8 to 30 characters long. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. For a Windows instance, the password cannot start with a forward slash (/).

Add, delete, or modify user information

  • Add a user and set a password

    useradd -m {{newUser}} && echo "{{newUser}}:{{password}}" | chpasswd
  • Change a password

    passwd {{password}}
  • Delete a user

    userdel {{newUser}}
  • Change a username

    usermod -l {{newUser}} -d /home/{{newUser}} -m {{previousUser}}

Enable, disable, and check the status of the firewall

  • Enable the firewall

    systemctl start firewalld
  • Disable the firewall

    systemctl stop firewalld
  • Check the firewall status

    systemctl status firewalld

Install software

Note

This example shows how to install Nginx on a CentOS 7 operating system.

yum -y install nginx

Install the CloudMonitor agent

Note

For more information, see Install and uninstall the CloudMonitor agent.

ARGUS_VERSION=3.5.7 /bin/bash -c "$(curl -s https://cms-agent-cn-hongkong.oss-cn-hongkong-internal.aliyuncs.com/Argus/agent_install_ecs-1.7.sh)"
Important

Replace cn-hongkong in the command with the region ID of your Simple Application Server instance. To obtain the region ID, see Regions and zones.

View server system configuration

  • View basic server configuration

    # Displays information about active network interface cards.
    ifconfig
    # Displays information about all network interface cards.
    ifconfig -a
    # Displays brief information about network interface cards.
    ifconfig -s
    # Views memory information.
    free -g
    # Views memory information.
    cat /proc/meminfo
    # Views operating system information, such as the kernel version.
    uname -a
    # Views disk usage.
    df -h
    # Views all hardware information.
    dmidecode | more
  • View system process or file information

    # Views information about all processes.
    ps -ef
    # Views information about a specific process. {{processName}} is the key of a custom parameter. You must set a value for it when you run the command.
    ps -ef | grep {{processName}}
    # Views the details of a file in a path.
    ls -la {{fileName}}
    # Finds a file path.
    find {{path}} | grep {{fileName}}

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.