All Products
Search
Document Center

Simple Application Server:Run a command

Last Updated:Mar 12, 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 on 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. You must specify this parameter based on your business requirements.

    • Enter Command Content: If no command exists, you can directly enter the parameters of the command that you want to run. In this example, 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.

    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 as ls -la /etc/profile in the Command Parameter field.

    You can create 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.

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

  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 running result.

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

Run a command on 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. On the My Commands tab, find the desired command and

  4. click Run in the Actions column.

  5. In the Run Command page, configure parameters based on your business requirements.

    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 one or more servers on which you want to run the command at the same time.

  6. Click Run.

  7. View the command running result.

    1. Click the Execution Result tab.

    2. View the basic information of the command, including the execution ID, execution status, and command type.

    3. Find the desired command and click View Details in the Actions column.

    4. On the Instances tab, click the image icon to view the command running result.

      image

Related operations

After you run a command, you can run the command again or export the command running 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.