1

i'm really confused on the formatting for crontrigger

http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger

ive been creating my own format for hours but to no avail :(

Edited*

what i need is to trigger every 10months, based on a specific date.

thanks :D

fwoop
  • 75
  • 1
  • 3
  • 7
  • 2
    What do you mean by 'every 10months, based on a specific date'? How do you want to calculate the trigger based on a 'specific date'? Please add an example of what you want to achieve. –  Nov 12 '12 at 09:04
  • For a concrete answer you should specify the problem better, like has been mentioned above. But eventually this will help you out enough: http://www.cronmaker.com/ – Hermann Hans Nov 12 '12 at 09:47
  • This website is incorrect anyway. It says the general format is `* * * * ? *` but the `?` should be last – Stewart Feb 24 '17 at 17:54

2 Answers2

0

Cron syntax is too limited to support "every 10 months" semantics since 10 is not an even divisor of 12 (you can easily express every 2, 3, 4 or 6 months with cron).

What you need is a CalendarIntervalTrigger:

This trigger can achieve schedules that are not possible with SimpleTrigger (e.g because months are not a fixed number of seconds) or CronTrigger (e.g. because "every 5 months" is not an even divisor of 12).

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
0

A cron expression is a string comprised of 6 or 7 fields separated by white space quartz-scheduler.org. Fields can contain any of the allowed values, along with various combinations of the allowed special characters for that field. The fields are as follows:

S.NO.  |   Field Name   |   Mandatory   |  Allowed Values   |  Special Characters 
 1.    |   Seconds      |     YES       |  0-59             |    , - * /
 2.    |   Minutes      |     YES       |  0-59             |    , - * /
 3.    |   Hours        |     YES       |  0-23             |    , - * /
 4.    |   Day of month |     YES       |  1-31             |    , - * ? / L W
 5.    |   Month        |     YES       |  1-12 or JAN-DEC  |    , - * /
 6.    |   Day of week  |     YES       |  1-7 or SUN-SAT   |    , - * ? / L #
 7.    |   Year         |      NO       |  empty            |    , 1970-2099 - * /

I used cronguru for creating my own cron expression.

Mukesh Kumar Gupta
  • 1,567
  • 20
  • 15