Home > Enterprise >  cronExpression for last day of month and every 10 min by using CronScheduleBuilder.cronSchedule
cronExpression for last day of month and every 10 min by using CronScheduleBuilder.cronSchedule

Time:01-30

I'm familiar with Cron on linux systems but by using Quartz Jobs, I have some doubts as the format is not really standard...

I would need a confirmation of the cronExpression syntax...

Here is the CronExpression I use to trigger my Job every 10 Min:

0 10 * ? * *

And here is the CronExpression to start this Job the last day of month at 11:15pm:

0 15 23 L * ?

Can you confirm the syntax is correct ? my expression to start every 10 min works fine, but it will avoid me to wait until the end of the month to test the second one !

CodePudding user response:

There are two points to consider here.

  1. The cron expression. What if it changes in the future? Other than reading the manual, lots of information is available online for describing or generating cron expressions (for just one example see here: https://www.freeformatter.com/cron-expression-generator-quartz.html)

  2. Testing it. How are you testing? The question lists Java. Are you using JUnit? Some code is needed but in general to be sure it will fire when you want it to, write a unit test and mock or override the system time.

  • Related