Spring cron expression every after 30 minutes

12,780

Solution 1

Cron syntax is

sec min hour day day_of_month month day_of_week year

So what you would want is

0 0,35 * * * * ?

So it will fire on minutes 0 and 35 of each hour.

See the Quartz docs for this, as Spring is using Quartz as scheduler here. Those docs also explain the special chars like * ? - , and others.

Solution 2

You have specified an increment instead of two values.

There is no minute 35 + 35 = 70. Replace 0/35 with 0,35.

Share:
12,780
d-man
Author by

d-man

Full stack Web Developer

Updated on June 04, 2022

Comments

  • d-man
    d-man almost 2 years

    Java spring - I have following cron expression for cron job.

    0 0/35 * * * ?
    

    But above mentioned cron expression fires once in an hour and like as follows

    1:35 2:35 3:35 4:35

    I want to fire every after 35 mins instead once in an hour

    any quick suggestion ?

  • Heiko Rupp
    Heiko Rupp over 12 years
    You are of course right - I read the "1:35 2:35 3:35 4:35" as the requirement
  • Heiko Rupp
    Heiko Rupp over 12 years
    Because I am stupid. (See my answer to your question on my answer). I have flagged it as "inform moderator" to cancel my downvote, as I can't cancel it myself.
  • Heiko Rupp
    Heiko Rupp over 12 years
    No, unfortunately I can't - it gives me a message that this is not possible - unless the answer is edited.
  • Heiko Rupp
    Heiko Rupp over 12 years
    Yes, that helped - sorry again.
  • tobiasbayer
    tobiasbayer over 12 years
    Thanks. So we can safely delete all comments now. :)