Updated on 2024-11-20 GMT+08:00

Scheduled Task Management

Creating a Scheduled Task

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scheduled O&M.

    Figure 1 Scheduled O&M
    Figure 2 Scheduled task list

  3. On the Scheduled O&M page, click Create Task in the upper right corner.

    Figure 3 Creating a scheduled task

  4. Enter the basic information about the scheduled task. Table 1 describes the required parameters.

    Figure 4 Entering basic information
    Table 1 Parameters

    Parameter

    Description

    Task

    Mandatory.

    The value can contain 3 to 100 characters, including letters, digits, hyphens (-), and underscores (_).

    Enterprise Project

    Mandatory.

    The drop-down data source is maintained by Enterprise Project Management.

    Version

    Mandatory.

    Version number of version management.

    IAM Agency

    Mandatory.

    Delegated permission to execute the scheduled task.

    NOTE:

    If the selected task is an ECS startup, ECS shutdown, ECS restart, OS patch scanning, or OS patch repair task in a public job, the system uses the ServiceAgencyForCOC agency by default.

    Risk Level

    Mandatory.

    There are three risk levels:

    • High
    • Medium
    • Low
      NOTE:

      If high risk is selected, manual review is enabled by default.

  5. Set the time zone. If you select Single execution, select the task execution time. If you select Periodic execution, the Simple Cycle and Cron options are displayed, allowing you to customize the execution period. The scheduled task is executed periodically based on the customized execution period, until the rule expires. Table 2 describes the required parameters.

    Figure 5 Scheduled Settings
    Table 2 Parameters

    Parameter

    Sub-parameter Name

    Description

    Time Zone

    -

    Mandatory.

    The scheduled task is executed based on the time zone.

    Task Type

    Single execution

    Execute the scheduled task at the specified time.

    Periodic execution

    Execute the task based on the specified rule until the rule expires.

    Executed

    -

    This parameter is used together with the task type.

    • For a single execution, set this parameter to the execution time.
    • For periodic execution, the following two modes are available:
      • Simple Cycle
      • Cron

    Rule Expired

    -

    If you select Periodic execution, you need to configure the rule expiration time.

  6. a. Enter the task type. If you select Scripts, search for a desired script by keyword from the drop-down script lists. Click before Scripts.

    Figure 6 Task Type

    b. Click View Selected Scripts. The script details are displayed on the right.

    Figure 7 Script Details

    c. Default script parameters are displayed in Script Input Parameters. You can select Sensitive to determine whether to display the parameters in plaintext. You can click the text box to edit the parameter values.

    d. Enter the execution user and the timeout interval.

    e. Select instances: Manual selection: manually select instances. Select All: Select all instances associated with a single region or application.

    Manual selection: Click + Add. The Select Instance page is displayed. Click Manual selection, set Enterprise Project, View Type, Resource Type, and Region, and search for the target instances in the search box. Select the check box before the instance list and click OK. Only instances whose UniAgent status is Running can be selected.

    Figure 8 Manually selecting instances (CloudCMDB ResourceS)
    Figure 9 Manually selecting instances (CloudCMDB application groups)

    Select All: Click Select All, set Enterprise Project, View Type, Resource Type, Region, and search for target instances on the search box. The list displays the instances that meet the current filter criteria. When a scheduled task is executed, the system queries the target instances in real time based on the selected filter criteria to execute the task. By default, only instances whose UniAgent Status is Running are displayed in the list.

    If you select a task of ECS startup, ECS shutdown, or ECS restart, and select Select All for Selection Method, a maximum of 500 instances can be selected at a time. If more than 500 instances need to be selected, manually select them.

    Figure 10 Selecting All (CloudCMDB resources)
    Figure 11 Selecting All (CloudCMDB application groups)

    f. Select the batch policy and suspension policy. If Select All is selected, batch processing is automatically performed.

    Figure 12 Page displayed when Manual selection is selected
    Figure 13 Page displayed when Select All is selected

  7. a. Select the task type. If you select Jobs, click the text box, select Custom Jobs or Common Jobs, and enter the key word in the search box to search for target jobs. Select the desired job.

    Currently, jobs that reference global parameters and jobs without target instances are not supported.

    Figure 14 Selecting Jobs

    b. Click View Selected Jobs. The job details are displayed on the right.

    Figure 15 Viewing job details

    c. Select the target instance mode. If you select Unique for each step, you can set the target instance and batch policy for each job step.

    Figure 16 Selecting Unique for each step

    d. Modify job execution parameters. Click a job step name. The job step details are displayed on the right. Set successRate and InstallStrategy, select Post-fault Operation Strategy, and click OK.

    Figure 17 Modifying job execution parameters
    Figure 18 Configuring a suspension and resumption policy
    Figure 19 Troubleshooting policy

    e. Select instances. You can select instances in either of the following ways:

    Manual selection: You need to manually select instances.

    Select All: Select all instances associated with a single region or application.

    f. Set Batch Policy and Suspension Policy.

  8. You can determine whether to enable Manual Review based on the service requirements.

    Figure 20 Setting manual review

  9. Determine whether to enable Send Notification based on service requirements. If enabled, set Notification Policy, Recipient, and Notification Mode.

    Figure 21 Setting notifications

  10. Click Submit.

    You can set the jobs and scripts to be executed on the Automated O&M > Scripts page or Automated O&M > Jobs page.

Viewing a Scheduled Task

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scheduled O&M.

    Figure 22 Scheduled tasks

  3. Click the search box. The search criteria list is displayed. Select search criteria, enter values, and press Enter to search for data. You can click the refresh icon next to the search box to refresh the data and set the fields to be displayed in the list.
  4. Click a task name to view the scheduled task details.

    Figure 23 Viewing task details

  5. On the scheduled task details page, click the script or job ID. The script or job details are displayed on the right.

    Figure 24 Script or job details

    System tenants are isolated. Only scheduled tasks created by tenant accounts or sub-accounts can be viewed.

Enabling and Disabling a Scheduled Task

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scheduled O&M.
  3. Locate a target task, and click Enable or Disable in the Operation column to enable or disable the scheduled task.

    Figure 25 Viewing task list

    1. Users can enable or disable only the scheduled tasks created by themselves. You can view scheduled tasks created by other users under the current tenant account.

    2. A task takes effect after it is enabled. When the execution time is reached, the task is executed. After a scheduled task is disabled, it is deleted from the background and will not be executed.

Editing a Scheduled Task

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scheduled O&M.
  3. Click Modify in the Operation column of a scheduled task. On the displayed page, modify the scheduled task information. Click Submit.

    Figure 26 Modifying a scheduled task

    1. Only scheduled tasks in the pending review or disabled state can be modified.

    2. After a scheduled task is modified and enabled again, it will be executed at the new execution time.

Deleting a Scheduled Task

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scheduled O&M.
  3. Locate the target task to be deleted, choose More > Delete in the Operation column, and click OK.

    Figure 27 Deleting a scheduled task

    Only disabled scheduled tasks can be deleted.

Reviewing Scheduled O&M Tasks

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scheduled O&M. Select a record whose status is Pending review and click the task name.

    Figure 28 Reviewing a scheduled task

  3. Click Approve in the upper right corner. In the displayed dialog box, select Passed or Not Passed and enter review comments. Click OK.

    Figure 29 Reviewing a scheduled task

    Only the task whose reviewer is the current login account can be reviewed. Only approved scheduled tasks can be enabled.