All Products
Search
Document Center

Simple Application Server:Run a command

更新時間:Dec 25, 2024

Command Assistant is an automated O&M tool for Simple Application Server. You can manage simple application servers by using shell, PowerShell, and batch commands in the Simple Application Server console without logging on to the servers. This topic describes how to run Command Assistant commands.

Prerequisites

  • The simple application server must be in the Running state.

  • Cloud Assistance Agent is installed on the server. By default, Cloud Assistant Agent is installed on each simple application server. If you manually uninstall Cloud Assistant Agent, you must reinstall it. For more information, see Install Cloud Assistant Agent.

Procedure

Run a command for a single server

  1. Log on to the Simple Application Server console.

  2. In the left-side navigation pane, click Servers.

  3. Click the server ID in the card of the desired server to go to the Server Overview tab.

    Note

    If you have multiple servers, you can enter the public IP address or ID of the server in the search box to filter the server.

  4. Click the Command Assistant tab.

  5. In the upper-right corner of the Command Assistant tab, click Run Command.

    Configure parameters as prompted. The following table describes the parameters.

    Parameter

    Description

    Command Name

    The name of the command.

    Command Type

    The type of the command.

    • Linux servers: Shell is supported.

    • Windows servers: Bat and PowerShell are supported.

    Command Source

    The source of the command. Valid values:

    • Enter Command Content: If no command exists, you can directly enter the parameters of the command that you want to run. In this topic, Enter Command Content is selected.

    • Select My Commands: If you have one or more existing commands, you can select the command that you want to run from the drop-down list.

    • Select Common Commands: Alibaba Cloud provides common Command Assistant commands for O&M, such as a command that is used to reset the password of a simple application server and a command that is used to query N processes that use the most memory on the server. You can select commands from the drop-down list.

    Command

    The command content. If you select Enter Command Content for Command Source, you must enter the 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.

    Used Parameters

    Specifies whether to use parameters.

    If you specify custom parameters in the {{key}} format in the Command field and turn on Used Parameters, you must enter the values of the parameters in the Command Parameters field.

    Username

    You can specify a user of the server to run the command. We recommend that you run the command as a regular user to reduce security risks.

    By default, Command Assistant commands are run by the root user on Linux servers and by the system user on Windows servers.

    Execution Path

    The working path of the command. You can specify a custom path. 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).

  6. After you configure the parameters, click Confirm.

  7. On the Command Assistant page, find the command that you ran and click View Task Details in the Actions column to view the details of the command execution result.

    The details of the command execution result include the execution ID, status, execution time, command type, execution result, and command content.

Run a command for multiple servers at the same time

  1. Log on to the Simple Application Server console.

  2. In the left-side navigation pane, click Command Assistant.

  3. Click My Comands or Common Commands based on your requirements.

a. On the My Commands tab, find the command that you want to run and click Run in the Actions column.

b. On the Common Commands tab, find the command that you want to run and click Run in the card of the command.

  1. In the Run Command panel, configure parameters and then click Run.

    1. In the Command Information section, configure command-related parameters and specify a user to run the command.

    2. In the Select Servers section, select multiple simple application servers.

  2. View the command execution result.

a. On the Execution Result tab, view the basic information of the command, including the execution ID, execution status, and command type.

b. Click View Details in the Actions column that corresponds to the command.

c. On the Instances tab, click the image icon to view the command execution result.

image

Related operations

After you run a command, you can run the command again or export the command execution information.

Operation

Description

Procedure

Re-run a command

When the server status or Command Assistant Agent status is abnormal, the command fails to be run. After you fix the status issue, you can re-run the command.

  1. In the left-side navigation pane, click Command Assistant.

  2. Click the Execution Result tab.

  3. Find the desired command and click Re-run in the Actions column.

  4. In the Re-run Command panel, select a server and click Run.

Export command information

You can export the details of a command.

  1. In the left-side navigation pane, click Command Assistant.

  2. Click the Execution Result tab.

  3. Find the desired command and click Export in the Actions column.

  4. View the exported JSON file in your local browser.