Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring cron expression for every after 30 minutes

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> 
like image 605
d-man Avatar asked Nov 02 '11 10:11

d-man


People also ask

How do I run a Cron job every 20 minutes?

Instead of a range of values, you can also use the asterisk operator. To specify a job to be run every 20 minutes, you can use “*/20”.

What is the cron expression for every 5 minutes?

“At every 5th minute.” Cron job every 5 minutes is a commonly used cron schedule. We created Cronitor because cron itself can't alert you if your jobs fail or never start. Cronitor is easy to integrate and provides you with instant alerts when things go wrong.


1 Answers

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).

like image 118
stacker Avatar answered Sep 20 '22 23:09

stacker