Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Quartz Cron Expression -- need help

 
anirban sarkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm facing a problem with Quartz scheduler.In my J2EE application i'm using Quartz for job scheduling.
I need cron expressions for the job set mentioned bellow:

Set 1
i)The job will run on every N months where N is a positive integer.
ii)Staring from any month choosen from Jan to Dec of the current year
iii)run on N th day of each month where N varries from 1 to 31.if the th day doesn't exist in the month consider the last day ohat month.
iv) Run time in HH:MM am pm format

Set 2
i)The job will run on every N months where N is a positive integer.
ii)Staring from any month choosen from Jan to Dec of the current year
iii)run on first monday of month
iv) Run time in HH:MM am pm format

Set 3
i)The job will run on every N months where N is a positive integer.
ii)Staring from any month choosen from Jan to Dec of the current year
iii)run on last day of month
iv) Run time in HH:MM am pm format

User can choose one of the above 3 set.

I need your help . It's very urgent.

Thanks
Anirban
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anirban sarkar:


I need your help . It's very urgent.



Have you tried to crate any expression so far .

We will help you , If you ShowSomeEfforts !

BTW, Take a look at this Quartz JavaDoc about CronExperssion, It has great information about How complicated Schedule can be written in easy way !!
 
anirban sarkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I havn't found any expression to create a cron trigger which will be fired on N th month interval(N=2,3,4,...)

For 5 month interval & start date= 5-Dec-2008 8:30 pm ,
I have tried with "0 30/5 20 5 12 ? *" but it didn't work.After that i got to know that 30/5 does not mean it'll run on 5 month interval basis.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anirban sarkar:
Hi

For 5 month interval & start date= 5-Dec-2008 8:30 pm ,
I have tried with "0 30/5 20 5 12 ? *" but it didn't work.After that i got to know that 30/5 does not mean it'll run on 5 month interval basis.


What are you incrementing by 5 is minute, 30/5, starting at 8:30, fired after each 5 minutes like 30, 35, 40, etc..

Try this,



Reads as :

Fire at 8:30 on 5th day of every next 5th month
 
anirban sarkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I've tried with 5 mins interval for testing purpose.
Now giving 1/5 in month field should it fire on JAN,JUN,NOV of current year and APR,SEP of next year and so on...?I need this scenario.
 
anirban sarkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Giving 1/5 in month field should it fire on JAN,JUN,NOV of current year and APR,SEP of next year and so on...?If no, what i'll do to implement this so that it'll be fired on 5 month interval (JAN,JUN,NOV of current year and APR,SEP of next year and so on...)?Here the start month is JAN.

Thanks
Anirban
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure, whether this works they way you want, but as per the documentation and my knowledge is concerned it should fire on every 5 month.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic