Quartz configuration time

Source: Internet
Author: User

We need to put the log4j configuration file under the src directory and start the main class.

Cron expressions (from the network ):

Cron expressions include the following seven fields:

  • Seconds
  • Minute
  • Hours
  • Date in month
  • Month
  • Week date
  • Year (optional)

Special characters

The cron trigger uses a series of special characters, as shown below:

Wildcard description:
* Indicates all values. For example, if "*" is set on the shard field, it indicates that each minute is triggered.
?Indicates that no value is specified. In this scenario, you do not need to care about the value of this field. For example, if you want to trigger an operation on the 10th day of each month, but do not care about the number of weeks, you need to set the field of the week location "? "Set to 0 0 0 10 *?
-Range. For example, if "10-12" is set on the hour, it indicates that the event will be triggered at, 11, and 12.
,Indicates that multiple values are specified. For example, if "mon, wed, Fri" is set on the weekly field, it indicates that the trigger is performed on Monday, Wednesday, and Friday.
/ Used for incremental triggering. For example, if "5/15" is set on the second, the trigger is triggered every 15 seconds (,) starting from 5 seconds ). Set '20140901' on the monthly field to start on the first day of every month and trigger once every three days.
LIndicates the last meaning. In the day field setting, it indicates the last day of the current month (based on the current month, if it is February, it will also be based on whether it is the runyear [leap]), in the week field, it indicates Saturday, it is equivalent to "7" or "sat ". If you add a number before "L", it indicates the last data. For example, if the format "6l" is set on the weekly field, it indicates "last Friday of the month"
WIndicates the business day closest to the specified date (Monday to Friday). For example, if "15 W" is set in the day field, it indicates the business day closest to the 15th day of each month. If it is Saturday on the 15th, it will be triggered on the latest Friday (14). If the 15th is not a week, it will be triggered on the latest Monday (16. if the 15th day is on a business day (Monday to Friday), it is triggered on that day. If the specified format is "1 W", it indicates the last workday triggered after the first day of every month. If the first day is Saturday, it will be triggered on the third day next Monday. (Note: Only specific numbers can be set before "W", and "-" is not allowed "-").

Tips

'L' and 'w' can be combined. If "LW" is set on the daily field, it indicates that it is triggered on the last workday of the month (generally pay-as-you-go)

#Number (the number of weeks in a month). For example, if "6 #3" is set in the week field, it indicates the Third Saturday of a month. NOTE: If "#5" is specified, this configuration will not be triggered if there is no Saturday in the fifth week. (This configuration is not suitable for Mother's Day and Father's Day)

Tips

Weekly field settings. If you use English letters, they are case-insensitive.Mon Same as Mon.

 

Special characters allowed for Field Values
Seconds 0-59 ,-*/
0-59 ,-*/
Hour 0-23 ,-*/
Date 1-31 ,-*? /L W C
Month 1-12 or JAN-DEC ,-*/
Day 1-7 or sun-Sat ,-*? /L c #
Year (optional) left blank, 1970-2099 ,-*/

Expression meaning
"0 0 12 **? "Triggered at noon every day
"0 15 10? ** "Triggered at every morning
"0 15 10 **? "Triggered at every morning
"0 15 10 **? * "Triggered at every morning
"0 15 10 **? 2005 "triggered at AM on July 15, 2005
"0*14 **? "Triggered every 1 minute from two o'clock P.M. to every day
"0 0/5 14 **? "Triggered every 5 minutes from two o'clock P.M. to every day
"0 0/5 **? "Triggered every 5 minutes from two o'clock P.M. to six o'clock P.M. and from to every day
"0 0-5 14 **? "Triggered every 1 minute from two o'clock P.M. to every day
"0 10, 44 14? 3 wed "triggered at and on Wednesday, January 1, March every year
"0 15 10? * MON-FRI "triggered at am from Monday to Friday
"0 15 10 15 *? "Triggered at AM on the 15th day of every month
"0 15 10 L *? "Triggered at AM on the last day of each month
"0 15 10? * 6l "triggered at AM on the last Friday of every month
"0 15 10? * 6l 2002-2005 "triggered at AM on the last Friday of each month from January 1, 2002 to March 31, 2005
"0 15 10? * 6 #3 "triggered at AM on the third Friday of every month
Every morning

0 6 ***

Every two hours

0 */2 ***
Every two hours from PM to am, am

0 23-7/2, 8 ***

Am from Monday 4 to Wednesday every week

0 11 4*1-3
Am, January 1, January 1

0 4 1 1 *

Quartz configuration time

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.