当前位置:网站首页>@ scheduled cron expression in quartz
@ scheduled cron expression in quartz
2022-04-22 08:49:00 【The figure under the stars】
Cron An expression is a string , String to 5 or 6 Space between , It is divided into 6 or 7 Domains , Each domain represents a meaning ,Cron There are two grammatical formats as follows :
1.Seconds Minutes Hours DayofMonth Month DayofWeek Year
2.Seconds Minutes Hours DayofMonth Month DayofWeek
The characters that can appear in each field are as follows :
Seconds: Can appear ", - * /" Four characters , The valid range is 0-59 The integer of
Minutes: Can appear ", - * /" Four characters , The valid range is 0-59 The integer of
Hours: Can appear ", - * /" Four characters , The valid range is 0-23 The integer of
DayofMonth : Can appear ", - * / ? L W C" Eight characters , The valid range is 0-31 The integer of
Month: Can appear ", - * /" Four characters , The valid range is 1-12 An integer of or JAN-DEc
DayofWeek: Can appear ", - * / ? L C #" Four characters , The valid range is 1-7 An integer of or SUN-SAT Two ranges .1 Sunday ,2 For Monday , By analogy
Year: Can appear ", - * /" Four characters , The valid range is 1970-2099 year
Every field uses numbers , But the following special characters can also appear , They mean :
(1) *: Represents any value that matches the field , If be in, Minutes Domain use *, It means that the event will be triggered every minute .
(2) ?: Can only be used in DayofMonth and DayofWeek Two domain . It also matches any value of the field , But it doesn't . because DayofMonth and DayofWeek Will affect each other . For example, I want to be in the 20 Daily trigger dispatch , No matter 20 What day is the day of the week , You can only write it as follows : 13 13 15 20 * ?, The last one can only use ?, They can't be used *, If you use * No matter what day of the week it will trigger , It's not like that .
(3) -: Scope of representation , For example, in Minutes Domain use 5-20, From 5 be assigned to 20 Trigger every minute
(4) /: Indicates that the start time starts to trigger , Then trigger every fixed time , For example, in Minutes Domain use 5/20, Means that the 5 Minutes to trigger , and 25,45 Wait for each trigger .
(5) ,: Indicates that enumeration values are listed . for example : stay Minutes Domain use 5,20, It means in 5 and 20 Minutes per minute .
(6) L: Said the last , Can only appear in DayofWeek and DayofMonth Domain , If in DayofWeek Domain use 5L, Means trigger on the last Thursday .
(7) W: Means effective working day ( Monday to Friday ), Can only appear in DayofMonth Domain , The system will trigger the event... On the most effective working day from the specified date . for example : stay DayofMonth Use 5W, If 5 It's Saturday , On the most recent working day : Friday , namely 4 Day trigger . If 5 Sunday is Sunday , It's in 6 Japan ( Monday ) Trigger ; If 5 The day is on Monday By the middle of Friday , It's in 5 Day trigger . Another point ,W Our latest search will not cross the month .
(8) LW: These two characters can be used together , On the last working day of a month , The last Friday .
(9) #: Used to determine the week ordinal of each month , Can only appear in DayofMonth Domain . For example, in 4#2, The second Wednesday of a month .
Take a few examples :
every other 5 Once per second :"*/5 * * * * ?"
every other 1 Once per minute :"0 */1 * * * ?"
Every day 23 Click to execute once :"0 0 23 * * ?"
Every morning 1 Click to execute once :"0 0 1 * * ?"
monthly 1 No. In the morning 1 Click to execute once :"0 0 1 1 * ?"
Last day of each month 23 Click to execute once :"0 0 23 L * ?"
Every Sunday morning 1 Do it once :"0 0 1 ? * L"
stay 26 branch 、29 branch 、33 Execute once :"0 26,29,33 * * * ?"
Daily 0 spot 、13 spot 、18 spot 、21 Do it all once :"0 0 0,13,18,21 * * ?"
In the month of 1 Early in the morning 2 Point scheduling tasks :"0 0 2 1 * ? *"
From Monday to Friday every morning 10:15 Perform operation :"0 15 10 ? * MON-FRI"
Express 2002-2006 Last Friday morning of each month of the year 10:15 perform :"0 15 10 ? 6L 2002-2006"
版权声明
本文为[The figure under the stars]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220750015552.html
边栏推荐
猜你喜欢
随机推荐
ROM、RAM、SRAM、DRAM、Flash、SDRAM区别
实现“ 字体逐渐展现 ”程序
PCIe learning - Introduction to PCIe bus architecture: transaction layer - data link layer - physical layer (8)
一棵开始成长的树
Reorganize notes: [Ultimate method] create user-defined code templates in vscade
1315. Sum of nodes with even grandfather node value (medium)
tar 源码包管理-源码包安装方法
Meaning of GMT and CST in programming
POI操作excel三剑客
111. Minimum depth of binary tree
==与equals
Nessus漏洞扫描简介
ROM, Ram, SRAM, DRAM, flash, SDRAM Difference
How does CSDN reprint other people's blogs
Rhel7 configuring local Yum source
JS跨域问题解决
226. Flip binary tree (easy)
Restore MySQL service after computer reset
CASE WHEN 及 SELECT CASE WHEN的用法 非常好用
如何清空输入缓冲区









