I am using Quartz Scheduler using Spring. I want to configure the same with following schedule:
Run Job Every 10 minutes starting NOW
I am using following expression for the same.
0 */10 * * * ?
I thought * in the minutes field would make it run the first minute, but it does not do that way. It runs the first 10th minutes from now and then every 10 minutes afterwards. Can anybody please suggest me the reason for this behavior and the solution to my problem also?
For example, if you have 1-10/2 in the Minutes field, it means the action will be performed every two minutes in range 1-10, same as specifying 1,3,5,7,9 . Instead of a range of values, you can also use the asterisk operator. To specify a job to be run every 20 minutes, you can use “*/20”.
Meaning of cron expression 0 * * * * *? I think it means the scheduler is expected to run every seconds.
A Cron Expressions quartz. Trigger. A cron expression is a string consisting of six or seven subexpressions (fields) that describe individual details of the schedule. These fields, separated by white space, can contain any of the allowed values with various combinations of the allowed characters for that field.
Execute Cron Job After System Reboot. Setup and Run PHP Script As A Cron Job. Run crontab job every minute on a Linux or Unix-like system.
0 0/10 * 1/1 * ? *
Please see : http://www.cronmaker.com/
check the minute your at now and add them as a list to your crontrigger. if you start the trigger at minute 12 for example add
0 2,12,22,32,42,52 * * * ?
as your cron expression
Edit:
Another solution would be to define a simpletrigger that repeats every ten minutes
SimpleTrigger trigger = new SimpleTrigger("myTrigger", null, new Date(), null, SimpleTrigger.REPEAT_INDEFINITELY, 10L * 60L * 1000L);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With