cron expression for every 30 seconds in quartz scheduler?

user1950349 picture user1950349 · Feb 5, 2016 · Viewed 57.5k times · Source

I am using Quartz Scheduler to run my jobs. I want to run my job every thirty seconds. What will be my cron expression for that?

For every one minute, I am using below cron expression:

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

What it will be for every thirty seconds?

Answer

Ian Mc picture Ian Mc · Feb 5, 2016

The first element represents the seconds; to run at second 0 and 30 use the following:

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