Alex Rivera | Logout

Spring cron expression for every after 30 minutes

Asked 2011-11-02T10:55:37.480
101

I have following Spring job to run after every 30 minutes. Please check my cron expression, is that correct?

0 0 0 * * 30

Here is a full cron job definition from the related Spring configuration file:

<bean id="autoWeblogPingTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="jobDetailForWeblogPing"/>
    <!-- run every 35 minutes -->
    <property name="cronExpression" value="0 0 0 * * 30" />
</bean>
Edit
Report

1 Answer

193

According to the Quartz-Scheduler Tutorial It should be value="0 0/30 * * * ?"

The field order of the cronExpression is

  1. Seconds
  2. Minutes
  3. Hours
  4. Day-of-Month
  5. Month
  6. Day-of-Week
  7. Year (optional field)

Ensure you have at least 6 parameters or you will get an error (year is optional).

answered 2011-11-02T10:59:01.143

Your Answer