Cron for every 30 seconds in a quartz scheduler?

I use Quartz Scheduler to complete my tasks. I want to do my job every thirty seconds. What will my cron expression be for?

For every minute, I use the cron expression below:

<cron-expression>0 0/1 * 1/1 * ? *</cron-expression>

What will it be every thirty seconds?

+9
source share
4 answers

The first element represents seconds; to start with second 0 and 30 use the following:

0/30 0/1 * 1/1 *? *

+15
source

We can achieve the same effect (Quartz Spring) using a simpler construction:

0/30 * * * * ? *

The last asterisk we can omit.

0/30 * * * * ?

Quartz planner cron trigger documentation 2.x

+2

Spring, @PostConstruct, @Scheduled(cron=0 0/15 * 1/1 * ?) , + 15 ..

0

I hope this answer helps you. Please define cron expression below

 0/30 * * * * ? *

And then you go to this site and test the Cron Expression Generator & Explanator - Quartz .

0
source

Source: https://habr.com/ru/post/1627367/


All Articles