Search code examples
javaquartz-schedulercronexpression

cron expression for every 30 seconds in quartz scheduler?


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?


Solution

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

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