All Products
Search
Document Center

SchedulerX:Cron

Last Updated:Jun 25, 2024

The cron command-line utility is a job scheduler that is used on Unix-like operating systems. You can use cron expressions to schedule jobs to run at a specified interval. The jobs can be scripts or commands.

Important

You cannot use cron expressions to schedule jobs at a second granularity. To schedule jobs at a second granularity, use second-delay expressions.

Cron expressions

The format of a cron expression is Seconds Minutes Hours Day Month Week [Year].

The following table lists commonly used cron expressions to help you better understand how cron expressions work.

Cron expression

Description

0 */1 * * * ?

Triggers a job at an interval of 1 minute.

0 0 5-15 * * ?

Triggers a job from 05:00 to 15:00 every day.

0 0/3 * * * ?

Triggers a job at an interval of 3 minutes.

0 0-5 14 * * ?

Triggers a job at an interval of 1 minute from 14:00 to 14:05 every day.

0 0/5 14 * * ?

Triggers a job at an interval of 5 minutes from 14:00 to 14:55 every day.

0 0/5 14,18 * * ?

Triggers a job at an interval of 5 minutes from 14:00 to 14:55 and from 18:00 to 18:55 every day.

0 0/30 9-17 * * ?

Triggers a job at an interval of 30 minutes from 09:00 to 17:00 every day.

0 0 10,14,16 * * ?

Triggers a job at 10:00, 14:00, and 16:00 every day.

0 0 12 ? * WED

Triggers a job at 12:00 on each Wednesday.

0 0 17 ? * TUES,THUR,SAT

Triggers a job at 17:00 on each Tuesday, Thursday, and Saturday.

0 10,44 14 ? 3 WED

Triggers a job at 14:10 and 14:44 on each Wednesday of each March.

0 15 10 ? * MON-FRI

Triggers a job at 10:15 from Monday to Friday each week.

0 0 23 L * ?

Triggers a job at 23:00 on the last day of each month.

0 15 10 L * ?

Triggers a job at 10:15 on the last day of each month.

0 15 10 ? * 6L

Triggers a job at 10:15 on the last Friday of each month.

0 15 10 * * ? 2005

Triggers a job at 10:15 on each day of 2005.

0 15 10 ? * 6L 2002-2005

Triggers a job at 10:15 on the last Friday of each month from 2002 to 2005.

0 15 10 ? * 6#3

Triggers a job at 10:15 on the third Friday of each month.

Examples of cron jobs

You can configure cron expressions when you create a scheduled job. For more information about how to create a job, see Create a job. The following procedure describes how to configure a cron expression when you create a scheduled job.

  1. Go to the Timing configuration step of the Create task wizard. For more information, see Create a job.

  2. In the Timing configuration step of the Create task wizard, configure the job scheduling parameters and click Next Step.

    创建任务-定时配置-Cron

    1. Select cron from the Time type drop-down list.

    2. Enter a cron expression.

      If you want to use a simple cron expression, you can click Use the build tool to generate the cron expression. In this example, the build tool is used to generate a cron expression. If the build tool cannot generate a complex cron expression that you need, you must manually build the cron expression. For more information about examples of cron expressions, see Cron expressions.

      1. Click Use the build tool.

      2. Select a time period and a time point from the drop-down list that appears and click Confirm. For example, you can specify a schedule to trigger the job at 03:00 every day.定时配置-Cron-工具生成

      3. Click Verify cron to view the five most recent time points to trigger the job based on the specified cron expression.定时配置-Cron 验证

    3. Optional. Configure Time offset and Time zone in the Advanced Configuration section based on your business requirements.

      If you set Time type to cron, you can configure advanced settings. The following table describes the advanced settings for a job.

      Parameter

      Description

      Time offset

      The offset between the timestamp of the data to be processed and the time when the job is triggered. You can obtain the offset value from the context when SchedulerX runs a job.

      Time zone

      Select the time zone of a country or region or select a GMT time zone based on your business requirements.