{"id":551,"date":"2023-02-25T17:50:20","date_gmt":"2023-02-25T09:50:20","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=551"},"modified":"2023-04-29T20:37:29","modified_gmt":"2023-04-29T12:37:29","slug":"quartz-cron-expression","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/quartz-cron-expression\/","title":{"rendered":"quartz Cron\u8868\u8fbe\u5f0f"},"content":{"rendered":"<h2>\u57fa\u672c\u4ecb\u7ecd<\/h2>\n<p>Cron\u8868\u8fbe\u5f0f\u88ab\u7528\u6765\u914d\u7f6eCronTrigger\u5b9e\u4f8b\u3002Cron\u8868\u8fbe\u5f0f\u662f\u5b57\u7b26\u4e32\uff0c\u5b9e\u9645\u4e0a\u662f\u7531\u4e03\u5b50\u8868\u8fbe\u5f0f\uff0c\u63cf\u8ff0\u4e2a\u522b\u7ec6\u8282\u7684\u65f6\u95f4\u8868\u3002\u8fd9\u4e9b\u5b50\u8868\u8fbe\u5f0f\u4ee5\u7a7a\u767d\u5206\u5f00\uff0c\u4ee3\u8868<\/p>\n<p><!-- more --><\/p>\n<ul>\n<li>Seconds<\/li>\n<li>Minutes<\/li>\n<li>Hours<\/li>\n<li>Day-of-Month<\/li>\n<li>Month<\/li>\n<li>Day-of-Week<\/li>\n<li>Year (\u53ef\u9009\u5b57\u6bb5)<\/li>\n<\/ul>\n<p>\u4f8b<code>0 0 12 ? * WED<\/code>\u8868\u793a\u5728\u6bcf\u661f\u671f\u4e09\u4e0b\u534812:00 \u6267\u884c<\/p>\n<p>\u4e2a\u522b\u5b50\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u542b\u8303\u56f4, \u4f8b\u5982\uff0c\u5728\u524d\u9762\u7684\u4f8b\u5b50\u91cc<code>&quot;WED&quot;<\/code>\u53ef\u4ee5\u66ff\u6362\u6210<code>&quot;MON-FRI&quot;<\/code>\u3001<code>&quot;MON, WED, FRI&quot;<\/code>\u751a\u81f3<code>&quot;MON-WED,SAT&quot;<\/code><\/p>\n<p><code>&quot;*&quot;<\/code>\u4ee3\u8868\u6574\u4e2a\u65f6\u95f4\u6bb5<\/p>\n<p>\u6bcf\u4e00\u4e2a\u5b57\u6bb5\u90fd\u6709\u4e00\u5957\u53ef\u4ee5\u6307\u5b9a\u6709\u6548\u503c\uff0c\u5982<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u5b57\u6bb5<\/th>\n<th style=\"text-align: left;\">\u6709\u6548\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">Seconds(\u79d2)<\/td>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u7528\u6570\u5b570-59 \u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Minutes(\u5206)<\/td>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u7528\u6570\u5b570-59 \u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Hours(\u65f6)<\/td>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u7528\u6570\u5b570-23\u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Day-of-Month(\u5929)<\/td>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u7528\u6570\u5b571-31 \u4e2d\u7684\u4efb\u4e00\u4e00\u4e2a\u503c\uff0c\u4f46\u8981\u6ce8\u610f\u4e00\u4e9b\u7279\u522b\u7684\u6708\u4efd<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Month(\u6708)<\/td>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u75280-11 \u6216<br \/>\u7528\u5b57\u7b26\u4e32 &quot;JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV and DEC&quot; \u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Day-of-Week(\u6bcf\u5468)<\/td>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u7528\u6570\u5b571-7\u8868\u793a\uff081=\u661f\u671f\u65e5\uff09\u6216<br \/>\u7528\u5b57\u7b26\u53e3\u4e32&quot;SUN, MON, TUE, WED, THU, FRI and SAT&quot;\u8868\u793a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code>\/<\/code>\uff1a\u4e3a\u7279\u522b\u5355\u4f4d\uff0c\u8868\u793a\u4e3a<code>\u6bcf<\/code>\uff0c\u5982<code>0\/15<\/code>\u8868\u793a\u6bcf\u969415\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c<code>0<\/code>\u8868\u793a\u4e3a\u4ece<code>0<\/code>\u5206\u5f00\u59cb\uff1b<code>3\/20<\/code>\u8868\u793a\u8868\u793a\u6bcf\u9694<code>20<\/code>\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c<code>3<\/code>\u8868\u793a\u4ece\u7b2c<code>3<\/code>\u5206\u949f\u5f00\u59cb\u6267\u884c<br \/>\n<code>?<\/code>\uff1a\u8868\u793a\u6bcf\u6708\u7684\u67d0\u4e00\u5929\uff0c\u6216\u6bcf\u5468\u7684\u67d0\u4e00\u5929<br \/>\n<code>L<\/code>\uff1a\u7528\u4e8e\u6bcf\u6708\uff0c\u6216\u6bcf\u5468\uff0c\u8868\u793a\u4e3a\u6bcf\u6708\u7684\u6700\u540e\u4e00\u5929\uff0c\u6216\u6bcf\u4e2a\u6708\u7684\u6700\u540e\u661f\u671f\u51e0\u5982<code>6L<\/code>\u8868\u793a<code>\u6bcf\u6708\u7684\u6700\u540e\u4e00\u4e2a\u661f\u671f\u4e94<\/code><br \/>\n<code>W<\/code>\uff1a\u8868\u793a\u4e3a\u6700\u8fd1\u5de5\u4f5c\u65e5\uff0c\u5982<code>15W<\/code>\u653e\u5728\u6bcf\u6708(day-of-month)\u5b57\u6bb5\u4e0a\u8868\u793a\u4e3a<code>\u5230\u672c\u670815\u65e5\u6700\u8fd1\u7684\u5de5\u4f5c\u65e5<\/code><br \/>\n<code>#<\/code>\uff1a\u662f\u7528\u6765\u6307\u5b9a\u6bcf\u6708\u7b2c\u51e0\u4e2a\u661f\u671f\u51e0\uff0c\u5982\u5728\u6bcf\u5468(day-of-week)\u8fd9\u4e2a\u5b57\u6bb5\u4e2d\u5185\u5bb9\u4e3a<code>6#3<\/code> or <code>FRI#3<\/code> \u5219\u8868\u793a<code>\u6bcf\u6708\u7b2c\u4e09\u4e2a\u661f\u671f\u4e94<\/code><\/p>\n<h2>Cron\u8868\u8fbe\u5f0f\u7684\u683c\u5f0f<\/h2>\n<p>Cron\u8868\u8fbe\u5f0f\u7684\u683c\u5f0f\uff1a\u79d2 \u5206 \u65f6 \u65e5 \u6708 \u5468 \u5e74(\u53ef\u9009)<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u5b57\u6bb5\u540d<\/th>\n<th style=\"text-align: left;\">\u5141\u8bb8\u7684\u503c<\/th>\n<th style=\"text-align: left;\">\u5141\u8bb8\u7684\u7279\u6b8a\u5b57\u7b26<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">\u79d2<\/td>\n<td style=\"text-align: left;\">0-59<\/td>\n<td style=\"text-align: left;\"><code>, - * \/<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u5206<\/td>\n<td style=\"text-align: left;\">0-59<\/td>\n<td style=\"text-align: left;\"><code>, - * \/<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u5c0f\u65f6<\/td>\n<td style=\"text-align: left;\">0-23<\/td>\n<td style=\"text-align: left;\"><code>, - * \/<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u65e5<\/td>\n<td style=\"text-align: left;\">1-31<\/td>\n<td style=\"text-align: left;\"><code>, - * ? \/ L W C<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u6708<\/td>\n<td style=\"text-align: left;\">1-12 or JAN-DEC<\/td>\n<td style=\"text-align: left;\"><code>, - * \/<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u5468\u51e0<\/td>\n<td style=\"text-align: left;\">1-7 or SUN-SAT<\/td>\n<td style=\"text-align: left;\"><code>, - * ? \/ L C #<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u5e74 (\u53ef\u9009\u5b57\u6bb5)<\/td>\n<td style=\"text-align: left;\">empty, 1970-2099<\/td>\n<td style=\"text-align: left;\"><code>, - * \/<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code>?<\/code>\u5b57\u7b26\uff1a\u8868\u793a\u4e0d\u786e\u5b9a\u7684\u503c<br \/>\n<code>,<\/code>\u5b57\u7b26\uff1a\u6307\u5b9a\u6570\u4e2a\u503c<br \/>\n<code>-<\/code>\u5b57\u7b26\uff1a\u6307\u5b9a\u4e00\u4e2a\u503c\u7684\u8303\u56f4<br \/>\n<code>\/<\/code>\u5b57\u7b26\uff1a\u6307\u5b9a\u4e00\u4e2a\u503c\u7684\u589e\u52a0\u5e45\u5ea6\u3002n\/m\u8868\u793a\u4ecen\u5f00\u59cb\uff0c\u6bcf\u6b21\u589e\u52a0m<br \/>\n<code>L<\/code>\u5b57\u7b26\uff1a\u7528\u5728\u65e5\u8868\u793a\u4e00\u4e2a\u6708\u4e2d\u7684\u6700\u540e\u4e00\u5929\uff0c\u7528\u5728\u5468\u8868\u793a\u8be5\u6708\u6700\u540e\u4e00\u4e2a\u661f\u671fX<br \/>\n<code>W<\/code>\u5b57\u7b26\uff1a\u6307\u5b9a\u79bb\u7ed9\u5b9a\u65e5\u671f\u6700\u8fd1\u7684\u5de5\u4f5c\u65e5(\u5468\u4e00\u5230\u5468\u4e94)<br \/>\n<code>#<\/code>\u5b57\u7b26\uff1a\u8868\u793a\u8be5\u6708\u7b2c\u51e0\u4e2a\u5468X\u30026#3\u8868\u793a\u8be5\u6708\u7b2c3\u4e2a\u5468\u4e94<\/p>\n<h2>Cron\u8868\u8fbe\u5f0f\u8303\u4f8b<\/h2>\n<p>\u6bcf\u96945\u79d2\u6267\u884c\u4e00\u6b21\uff1a<code>*\/5 * * * * ?<\/code><br \/>\n\u6bcf\u96941\u5206\u949f\u6267\u884c\u4e00\u6b21\uff1a<code>0 *\/1 * * * ?<\/code><br \/>\n\u6bcf\u592923\u70b9\u6267\u884c\u4e00\u6b21\uff1a<code>0 0 23 * * ?<\/code><br \/>\n\u6bcf\u5929\u51cc\u66681\u70b9\u6267\u884c\u4e00\u6b21\uff1a<code>0 0 1 * * ?<\/code><br \/>\n\u6bcf\u67081\u53f7\u51cc\u66681\u70b9\u6267\u884c\u4e00\u6b21\uff1a<code>0 0 1 1 * ?<\/code><br \/>\n\u6bcf\u6708\u6700\u540e\u4e00\u592923\u70b9\u6267\u884c\u4e00\u6b21\uff1a<code>0 0 23 L * ?<\/code><br \/>\n\u6bcf\u5468\u661f\u671f\u5929\u51cc\u66681\u70b9\u5b9e\u884c\u4e00\u6b21\uff1a<code>0 0 1 ? * L<\/code><br \/>\n\u572826\u5206\u300129\u5206\u300133\u5206\u6267\u884c\u4e00\u6b21\uff1a<code>0 26,29,33 * * * ?<\/code><br \/>\n\u6bcf\u5929\u76840\u70b9\u300113\u70b9\u300118\u70b9\u300121\u70b9\u90fd\u6267\u884c\u4e00\u6b21\uff1a<code>0 0 0,13,18,21 * * ?<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u672c\u4ecb\u7ecd Cron\u8868\u8fbe\u5f0f\u88ab\u7528\u6765\u914d\u7f6eCronTrigger\u5b9e\u4f8b\u3002Cron\u8868\u8fbe\u5f0f\u662f\u5b57\u7b26\u4e32\uff0c\u5b9e\u9645\u4e0a\u662f\u7531\u4e03\u5b50\u8868\u8fbe\u5f0f\uff0c\u63cf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97],"tags":[168],"class_list":["post-551","post","type-post","status-publish","format-standard","hentry","category-tools-skills","tag-cron"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=551"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/551\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}