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).
Procedure
- 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 command execution tasks need to be executed at a fixed interval. Note When you specify 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 task.
- The interval is the amount of time elapsed between two consecutive executions. The interval is irrelevant to the amount of time required to run the command once. For example, assume that you set the interval to 5 minutes and that it takes 2 minutes to run the command each time. Each time the command is run, the system waits 3 minutes before it runs the command again.
- A task is not executed immediately after the task is created. For example, assume that you set the interval to 5 minutes and create a task to run the command. The task begins to run 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 to run the command. Specify a schedule 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 applicable when tasks need to run on a schedule. For more information about cron expressions, see Cron expressions. 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).
- 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 command execution 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.