Crontrigger Expression of quartz

Source: Internet
Author: User

Crontrigger

Crontriggers tend to be more useful than simpletrigger if you need a calendar-based concept, rather than simpletrigger a fully specified time interval, recurrence of the launch work schedule.
Crontrigger, you can specify a trigger schedule such as "Every Friday noon", or "every weekday 9:30", or even "every 5 minutes 9:00 and 10:00 per Monday a.m., Wednesday Friday".
Even so, like Simpletrigger, Crontrigger owns the starttime when the specified timesheet is in effect, and the specified timesheet should stop (optional) the end time.

Cron Expressions

The cron expression is used to configure the Crontrigger instance. The cron expression is a string, which is actually a schedule of seven sub-expressions that describe individual details. These sub-expressions are separate blanks, which represent:

    1. 1. Seconds
    2. 2. Minutes
    3. 3. Hours
    4. 4. day-of-month
    5. 5. Month
    6. 6. Day-of-week
    7. 7. year ( optional field )

Example "0 0 12? * WED "executed every Wednesday 12:00,

Individual sub-expressions can contain ranges, for example, in the previous example ("WED") can be replaced by "Mon-fri", "MON, WED, FRI" or even "Mon-wed,sat".

"*" represents the entire time period.

Each field has a set of valid values that can be specified, such as

Seconds (seconds): can be represented by the number 0-59,

Minutes ( min): can be represented by the number 0-59,

Hours ( time): can be represented by the number 0-23,

day-of-month ( days): You can use any of the one by one values in the number 1-31, but be aware of some special months

Month: can be used with 0-11 or string "JAN, FEB, MAR, APR, May, June, JUL, April, SEP, OCT, NOV and DEC" indicated

Day-of-week ( weekly ) : can be represented by the number 1-7 (1 = Sunday) or by the word Fukou string "SUN, MON, TUE, WED, THU, FRI and SAT"

"/": For a special unit, expressed as "each", such as "0/15" means to execute every 15 minutes, "0" is expressed as starting from "0", "3/20" means to execute every 20 minutes, "3" for the 3rd minute start of execution

“?” : Indicates a day of the month, or a day of the week

"L": For each month, or weekly, expressed as the last day of the month, or the last week of each month as "6L" means "last Friday of the month"

"W": indicated as the most recent weekday, as "15W" is placed on the monthly (day-of-month) field as "the most recent working day of 15th this month"

"#": Is used to specify "the nth working day of the month, the example in the weekly (Day-of-week) This field is" 6#3 "or" fri#3 "means" the third Friday per month "

1) Cron expression format: Second-time time-of-year (optional).

Allowed special characters for field name allowed values
Seconds 0-59,-*/
Sub 0-59,-*/
Hours 0-23,-*/
Day 1-31,-*? /L W C
Month 1-12 or JAN-DEC,-*/
How many weeks 1-7 or SUN-SAT,-*? /L C #
Year (optional field) empty, 1970-2099,-*/

“?” Character: Represents an indeterminate value

"," character: Specify a number of values

"-" character: Specifies the range of a value

"/" character: Specifies the increment of a value. N/m means starting with N, increasing m each time

"L" character: Used on the last day of the one month, used in the week to represent the last one weeks of the month X

"W" character: Specifies the most recent weekday from the given date (Monday to Friday)

The "#" character: The number of weeks that the month is X. 6#3 said the 3rd Friday of the Month

2) Cron Expression Example:

Execute once every 5 seconds: */5 * * * *?

Executes every 1 minutes: 0 */1 * * *?

Executed at 23 o ' Day: 0 0 23 * *?

Once daily 1 o'clock in the morning: 0 0 1 * *?

Every month, 1th, 1 o'clock in the morning, once: 0 0 1 1 *?

The last day of the month is executed at 23 points: 0 0 L *?

Once a week, Sunday 1 o'clock in the morning: 0 0 1? * L

At 26, 29, 33, execute once: 0 26,29,33 * * *?

Every day 0, 13, 18, 21 points are executed once: 0 0 0,13,18,21 * *?

Crontrigger Expression of quartz

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.