All Products
Search
Document Center

Elastic Compute Service:Clone a command

Last Updated:Dec 13, 2023

You can clone an existing Cloud Assistant command to create another command. You can retain all information of the original command (cloned command), or modify the name, description, type, content, execution path, or timeout period for the new command (command clone).

Procedure

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Maintenance & Monitoring > Cloud Assistant.

  3. In the upper-left corner of the top navigation bar, select a region. 地域

  4. On the Commands tab, find the Cloud Assistant command that you want to clone, and click Clone in the Actions column.

  5. In the Clone Command panel, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Command Name

    Enter a name for the new command.

    Execution Plan

    Select a command execution plan.

    • Immediate execution: The command is run immediately after you click Run or Execute and Save.

    • After the next startup of the system: The command is run the next time the selected instances are started after you click Run or Execute and Save.

    • After each system startup: The command is run each time the selected instances are started after you click Run or Execute and Save.

    • Run on Schedule: The command is run at a specified interval, at a specified time, or on a schedule after you click Run or Execute and Save. If you set Implementation plan to Run on Schedule, the following options are available:

      • Run at Fixed Interval: Use a rate expression to specify an interval at which you want to run the command. You can specify the interval in seconds, minutes, hours, or days. This option is suitable when you want to execute command execution tasks at a fixed interval.

        Note

        When you specify an interval, take note of the following limits:

        • The specified interval can range from 60 seconds to 7 days and must be longer than the timeout period of the scheduled task.

        • The interval is the amount of time elapsed between two consecutive executions and is irrelevant to the amount of time required to run the command once. For example, you set the interval to 5 minutes and the amount of time required to run the command once is 2 minutes. Each time the command is run, the system waits 3 minutes before the system re-runs the command.

        • A task is not executed immediately after the task is created. For example, you set the interval to 5 minutes and create a task to run the command. The task runs 5 minutes after it is created.

      • Run Only Once at Specified Time: Specify a point in time and a time zone to run the command only once.

        For example, if you set Execution Time to May 17, 2022, 17:30:50 and Time Zone to (GMT+08:00) Asia/Shanghai, the command was run only once at 17:30:50 on May 17, 2022 (UTC+8).

      • Run on Clock-based Schedule: Use a cron expression to specify a schedule on which you want to run the command. Specify a schedule that is accurate to the second, minute, hour, day of the month, month, day of the week, or year, and select a time zone from the Time Zone drop-down list. The system calculates the schedule based on the cron expression and time zone and runs the command as scheduled. This option provides flexibility and is suitable when you want to execute command execution tasks on a schedule. For more information about cron expressions, see Run a command on a schedule.

        Note

        The minimum interval must be 10 seconds or more and cannot be shorter than the timeout period of scheduled executions.

        For example, if you set Execution Frequency to 0 0 12 ? * WED 2022 and Time Zone to (GMT+08:00) Asia/Shanghai, the system runs the command at 12:00:00 every Wednesday in 2022 (UTC+8).

    Command Type

    Select a command type.

    • For Linux instances, select Shell, Python, or Perl.

    • For Windows instances, select Bat or PowerShell.

    Command content

    Enter or paste the command content.

    For information about shell commands, see View the system configurations of an instance.

    Command Description

    Enter a description for the new command. We recommend that you enter identifiable information, such as the purpose of the command, to facilitate management and maintenance.

    Execution Path

    Specify an execution path for the new command. Default execution paths for instances that use different operating systems:

    • For Linux instances, the default execution path is the /home directory of the root user.

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

    Timeout

    Specify a timeout period for the new command to run on instances. If a task that runs a command times out, Cloud Assistant forcefully stops the task process.

    Unit: seconds. Default value: 60. Minimum value: 10. If you set Timeout to a value of less than 10, the system changes the value to 10 to ensure that the execution succeeds.

  6. After you confirm the configured parameters, click Clone.