I am using the Quartz Scheduling API for Java. Could you help me to run every 25 seconds using cron-expression. It's just a delay. It does not have to start always at second 0. For example, the sequence is like this: 0:00, 0:25, 0:50, 1:15, 1:40, 2:05, etc until minute 5 when the sequence begins again at second 0. Thank you.
Cron only allows for a minimum of one minute. What you could do is write a shell script with an infinite loop that runs your task, and then sleeps for 5 seconds. That way your task would be run more or less every 5 seconds, depending on how long the task itself takes.
“cron run every second” Code Answer's*/10 * * * * * will run every 10 sec.
I don't think cron expression will allow you to do that, but you can use
SimpleScheduleBuilder.repeatSecondlyForever( 25 )
as 300 (5 minutes) is a multiple of 25 it will repeat automatically.
If you want a job to trigger at a regular interval then you can use a Quartz SimpleTrigger
with a repeatInterval
specified.
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