Updated on 2026-06-23 GMT+08:00

Batch Executing Commands on COC

In routine ECS management, O&M personnel typically need to update configurations and install software on multiple ECSs. However, the traditional method of manually logging in to each ECS and executing commands is time-consuming, labor-intensive, and error-prone. To address this challenge, COC delivers the batch ECS operation function. With this function, you can deliver script commands to one or more ECSs without logging in to them. This helps you quickly handle routine maintenance on them.

Precautions

  • You can perform this operation only when the selected instances are running.
  • UniAgent of the selected instance must be running. For details about UniAgent-related operations, see Installing UniAgent on a Host.
  • If the selected ECSs run different OSs (Linux and Windows), you need to deliver commands to the ECSs separately.

Constraints

Currently, only ECSs support batch command execution.

Batch Executing Commands on ECSs

  1. Log in to COC.
  2. In the navigation pane, choose Resource O&M > Batch Resource Operations.
  3. On the displayed page, choose the Elastic Cloud Server (ECS) tab. Click Execute Commands.
  4. Set parameters for executing a command.

    Table 1 Parameter configurations

    Parameter

    Description

    Target Instance

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

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

    Operating System

    OS 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 preset value 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 to 1800 seconds (24 hours)

    Unit: second

    Command Type

    Type of the script commands that can be submitted.

    • For an ECS instance running Windows, you can set this parameter to Bat.
    • For an ECS instance running Linux, Shell is used by default and Python is also supported.

    Command Input

    Input box of the commands to be submitted.

    The input must be a command that produces a result after a single execution, meaning no further interaction with the command's output is required.

    NOTE:

    After a command is executed, you can enter another command in the command input box and run the command.

    Command Output

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

    Table 2 Parameters for selecting an instance

    Parameter

    Description

    Example Value

    Selection Method

    Select an instance selection method.

    Manual Selection: Manually select one or more instances based on settings of 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 by resource type.
    • CloudCMDB application groups: Select an instance by application group.

    CloudCMDB resources

    Resource Type

    The preset 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 displayed instances manually or automatically.

    -

  5. Click OK to run the command.

    After the command is executed, you can view the command output.

    Figure 1 Checking execution results

Helpful Links

You can use the batch command execution function of COC to send commands to multiple ECSs concurrently. Using COC to Batch Execute Commands for Multiple ECSs.