Help Center/ ROMA Connect/ User Guide (ME-Abu Dhabi Region)/ FAQs/ Data Integration Tasks/ How Can I Configure the Time for Triggering a Scheduled Task of FDI?
Updated on 2024-07-10 GMT+08:00

How Can I Configure the Time for Triggering a Scheduled Task of FDI?

You can configure the time for triggering a scheduled task by using a Quart Cron expression. A Quart Cron expression is a string comprised of six fields separated by space characters. The six fields in the expression are described as follows:
Seconds  Minutes  Hours  Day (day in each month)  Month  Week

Table 1 describes the meanings of each field in the QuartZ Cron expression.

Table 1 Fields in the QuartZ Cron expression

Name

Mandatory

Optional Values

Optional Special Characters

Seconds

Yes

0-59

, - * /

Minutes

Yes

0-59

, - * /

Hours

Yes

0-23

, - * /

Day (day in each month)

Yes

1-31. Note that there are no 30 and 31 in February, and there is no 31 in April, June, September, and November.

, - * ? / L W C

Month

Yes

1-12 or a character string

, - * /

Week

Yes

1-7 or a character string

, - * ? / L C #

The month in a cron expression can be a number or character string. If you want to set the month to January, either 1 or JAN complies with the QuartZ Cron expression. For details about the mapping between numbers and character strings, see Table 2.

Table 2 Mapping between numbers and character strings for the month

Numeral

String

1

JAN

2

FEB

3

MAR

4

APR

5

MAY

6

JUN

7

JUL

8

AUG

9

SEP

10

OCT

11

NOV

12

DEC

The week in a QuartZ Cron expression can be a number or character string. If you want to set the day to Monday, either 2 or MON complies with the QuartZ Cron expression. For details about the mapping between numbers and character strings, see Table 3. The QuartZ Cron expression defines Saturday as the last day of each week.

Table 3 Mapping between numbers and character strings for the week

Numeral

String

Description

1

SUN

Sunday

2

MON

Monday

3

TUE

Tuesday

4

WED

Wednesday

5

THU

Thursday

6

FRI

Friday

7

SAT

Saturday

Precautions

Besides numbers in each part, the following special characters can also be displayed:

  1. *: It can match any value of a field. If * is used in the minutes field, an event is triggered every minute.
  2. ?: It can only be used in two fields: day (day in each month) and week. It can also match any value of the field, but actually it does not. This is because day (day in each month) and week are mutually affected. For example, if you want to trigger scheduling on the 20th day of each month, you can use the following expression: 13 13 15 20 * ?, where the last digit can only be ?, but not *. If you use *, an event will be triggered regardless of the day of week.
  3. -: It specifies a range. For example, 5-20 in the minutes field means that an event is triggered every minute from minutes 5-20.
  4. /: An event is triggered from the specified time and at a fixed interval. For example, if you set the minutes field to 5/20, it means that the scheduled task will be triggered at the 5th, 25th, and 45th minutes of each hour.
  5. ,: It specifies a list value. For example, if you set the minutes field to 5,20, it means that the scheduled task will be triggered every minute between minutes 5 and 20 of each hour.
  6. L: It indicates the last. It can appear only in the day (day in each month) and week fields. For example, 5L in the day (day in each month) field means that the event is triggered on the last Thursday.
  7. W: It indicates a weekday (Monday to Friday) nearest the given day. It can appear only in the day (day of month) field. An event will be triggered on the valid weekday closest to the specified date. For example, 5W in the day (day of month) field means that an event will be triggered on the nearest weekday to the 5th day of the month. If the 5th day is Saturday, an event will be triggered on the 4th day (Friday). If the 5th day is Sunday, an event is triggered on the 6th day (Monday). If the 5th day is one day from Monday to Friday, an event is triggered on the 5th day. The trigger will not jump over the boundary of a month's days.
  8. LW: The two characters indicate the last weekday of a month, that is, the last Friday.
  9. #: It indicates the nth day of a week in each month. It can appear only in the day (day of week) field. For example, 4#2 indicates the second Wednesday of a month.

Examples

The following examples help you better understand the meanings of the QuartZ Cron expression. The simple examples show the primary use of QuartZ Cron expressions. The common examples show how to use QuartZ Cron expressions in actual scenarios. You only need to simply modify common examples based on site requirements.

Simple examples:
0/5 * * * * ? //Executed every five seconds
0 0/1 * * * ? //Executed every one minute
0 0 23 * * ? //Executed at 23:00 every day
0 0 1 1 * ? //Executed at 01:00 on the first day of each month
0 0 23 L * ? //Executed at 23:00 on the last day of each month
0 33,55 * * * ? //Executed at the 33th and 55th minute
0 0 18 * * LW //Executed at 06:00 on the last weekday of each month
Common examples:
0 0 12 * * ? //Executed at 12:00 every day
0 * 14 * * ? //Executed every minute from 02:00 to 02:59 every day
0 0/30 9-17 * * ? //Executed every half an hour within working hours from 09:00 to 17:00
0 0 12 ? * WED //Executed at 12:00 every Wednesday
0 0/30 9-17 * * MON-FRI //Executed every half an hour from 09:00 to 17:00 every day from Monday to Friday
0 15 10 ? * MON-FRI //Executed at 10:15 every day from Monday to Friday
0 0 2 1 * ? //Executed at 02:00 on the first day of each month
0 15 10 ? * 6#3 //Executed at 10:15 on the third Friday of each month
0 15 10 ? * 6L //Executed at 10:15 on the last Friday of each month