A command clone operation creates a new version of an existing Cloud Assistant command. You can retain all the information of the original command (cloned command), or you can modify information such as the name, description, type, content, execution path, or timeout period in the new command (command clone).
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- On the Commands tab, find the Cloud Assistant command that you want to clone and click Clone in the Actions column.
- In the Clone Command panel, configure the parameters described in the following table.
Parameter Description Command Name Specify a name for the new command. Implementation 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 to run the command. You can
specify the interval in seconds, minutes, hours, or days. This option is applicable
when tasks need to be executed at a fixed interval.
Note When you set an interval, take note of the following limits:
- The specified interval can be anywhere from 60 seconds to 7 days and must be longer than the timeout period of the scheduled recurring task.
- The interval is the duration between the start time of two consecutive executions. The interval is irrelevant to the time required to run the command. For example, if a command takes 2 minutes to complete and you set the interval to 5 minutes, the command is run again 3 minutes after the previous execution completes.
- Tasks are not run immediately after they are created. For example, if you set the task interval to 5 minutes, 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 2022-05-17 17:30:50 and Time Zone to (GMT+8: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 to run the command. Specify
the schedule with 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 execution times of the command based on this cron expression and time zone and
runs the command as scheduled. This option provides flexibility and is applicable
when tasks need to run on a regular basis. For more information about cron expressions,
see Cron expression.
Note The minimum interval must be 10 seconds or more and cannot be shorter than the timeout period of the recurring task.
For example, if you set Execution Frequency to 0 0 12 ? * WED 2022 and set Time Zone to (GMT+8:00) Asia/Shanghai, the system runs the command at 12:00 every Wednesday in 2022 (UTC+8).
- Run at Fixed Interval: Use a rate expression to specify an interval at which to run the command. You can specify the interval in seconds, minutes, hours, or days. This option is applicable when tasks need to be executed at a fixed interval.
Command Type Select a command type.
- For Linux instances, select Shell, Python, or Perl.
- For Windows instances, select Bat or PowerShell.
Command Enter or paste the command content.
For more information about shell commands, see View instance configurations.
Command Description Specify a description for the new command. We recommend that you set a description with information such as the command purpose that makes the command easy to identify, manage, and maintain. Execution Path Specify an execution path for the new command. Different default execution paths are provided based on the operating system of instances on which the command is run.
- 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 Period Set the 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 Period to a value of less than 10, the system changes the value to 10 to ensure that the execution succeeds.
- After you confirm the configured parameters, click Clone.