Updated on 2025-08-08 GMT+08:00

Batch Executing Commands on ECSs

Scenarios

COC provides unified operations on ECSs. You can submit script commands to one or more ECSs without login to quickly perform routine maintenance on them.

Precautions

You can perform this operation only when the selected instance is running.

The UniAgent instance must be running. For details, see Configuring UniAgent.

If the selected ECSs run on different OSs (Linux and Windows), you need to submit commands to the ECSs separately.

Executing a Command

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Batch Resource Operations.
  3. On the displayed page, choose the Elastic Cloud Server (ECS) tab and click Execute Commands.
  4. Set Execute Commands.

    Table 1 Parameter configurations

    Parameter

    Description

    Target Instance

    Click Add and configure the parameters on the Select Instance dialog box.

    For details about the parameters, see Table 2 Parameters for selecting an instance.

    Operating System

    Operating system of the target instance. Currently, Linux and Windows are supported.

    Select the operating system of the target instance.

    Executed By

    User who executes the commands.

    • For an ECS running on Windows, the preset value is system and the value cannot be changed.
    • For an ECS running on Linux, the preset value is root. You can change it as needed.

    Execution Plan

    Execution plan of the commands. The default setting is Execute Now.

    Timeout Interval

    Timeout interval for an individual command execution. If the command execution times out, the command submission will be stopped forcibly.

    Value range: 6–1,800 seconds (24 hours)

    Unit: second

    Command Type

    Type of the script commands that can be submitted.

    • For an ECS running on Windows, you can set Bat.
    • For an ECS running on Linux, Shell is set by default and Python is also supported.

    Command Input

    Input box of the commands to be submitted.

    The input content must be a command that can return results after a single execution. Interaction with the command output is not supported.

    Command Output

    Output box of the commands. You can view the command execution results.

    Table 2 Instance parameters

    Parameter

    Description

    Example Value

    Selection Method

    Select an instance selection method.

    • Manual Selection: Manually select an instance based on Enterprise Project, View Type, Resource Type, Region, and Target Instance.
    • Select All: Automatically select all instances based on Enterprise Project, View Type, Resource Type, Region, and Target Instance.

    Manual Selection

    Enterprise Project

    Select an enterprise project from the drop-down list. You can choose All.

    All

    View Type

    Select a view type.

    • CloudCMDB resources: Select an instance from the resource list.
    • CloudCMDB application groups: Select an instance from the application group list.

    CloudCMDB resources

    Resource Type

    The default value is used and cannot be changed.

    ECS

    Region

    Select a region from the drop-down list.

    CN-Hong Kong

    Target Instance

    Set filter criteria in the filter box and select the filtered instances manually or automatically.

    -

  5. Click OK.

    The command starts to be executed.