Reputation: 8251
I want my cron job to run exactly at the below times. I am using Java, Spring, and Quartz.
6:30 Am, 9 AM, 12 PM, 2 PM
I tried below, not sure if its correct. Please let me know if this is correct:
0 30,0,0 6,9,12 * *
Here's my Spring XML snippet:
<bean id="test" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="testjob"/>
</property>
<property name="cronExpression">
<value>0 30,0,0 6,9,12 * * ?</value>
</property>
</bean>
Upvotes: 1
Views: 1105
Reputation: 1006
I would suggest you create these as 2 separate crons, one for the half past the hour ones and one for the on the hour ones.
so for 6:30 Am, 9 AM, 12 PM, 2 PM
create the following two...
0 30 6 * * ?
and
0 0 9,12,14 * * ?
Just to be sure you understand, you will need to create a second CronTriggerBean
with the second cronExpression but you can reuse the job. The initial cron you tried would not work; you will need two cron expressions however you look at it.
Upvotes: 4