Quarzt.net's Cron expression understanding

Source: Internet
Author: User

There are a lot of cron expressions about quarzt.net on the internet, but they are all basic syntax, and a little bit deeper is not.

For a basic syntax introduction, see:

Http://www.cnblogs.com/lzrabbit/archive/2012/04/14/2371420.html

A complex requirement was encountered in the project: during the 2014-01-01 to 2015-12-31 interval, the task is performed every two minutes from 00:10:00 to 08:20:00 every day.

At first I wanted to do it with a cron expression, it was wrong, and I didn't understand Cron.

Later in Csdn consulted a master, resolved, the connection address is as follows:

http://bbs.csdn.net/topics/390922376

In combination with the two-week project, the cron expression is recorded to facilitate the understanding of those who need it.

The hour can have the concept of interval, for example: 00 20 00-15/2 01-31 01-12? 2014-2014
is at 0 to 15 points of 20 points, every 2 hours to execute once.

But seconds and minutes have no concept of interval, because the interval depends on the hour;
For example: 00 20-30/2 00-15 01-31 01-12? 2014-2014
The meaning of this representation is 0 to 15 hours per hour of 20 to 30 minutes between every 2 minute execution.
Instead of 00:20:00 to 15:30:00 every 2 minutes.

0/30 11 00 01-31 01-12? 2014-2014
0/30 0 1-14 01-31 01-12? 2014-2014
0/30 0-40 15 01-31 01-12? 2014-2014
These three expressions mean: Execute 2 times at 0:11
Execute 2 times at 0 ticks from 1 to 14.
Execute once every 30 seconds at 15 points of 0 to 40 minutes

0/30 11-59 00 01-31 01-12? 2014-2014
0/30 * 1-14 01-31 01-12? 2014-2014
0/30 0-40 15 01-31 01-12? 2014-2014
These three expressions mean: 1 times every 30 seconds after 0:11
Executes 1 times every 30 seconds from 1 to 14.
Execute once every 30 seconds at 15 points of 0 to 40 minutes


0 49/2 00 01-31 01-12? 2014-2014
0 0/2 1-14 01-31 01-12? 2014-2014
0 0-21/2 15 01-31 01-12? 2014-2014
These three expressions mean: Start every 2 minutes at 0:49
Executes 1 times every 2 minutes from 1 to 14.
At 15 points of 0 to 21 minutes per 2-minute execution

Quarzt.net's Cron expression understanding

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.