Home > other >  When does this @Scheduled(cron = "0 0 0/24 * * ?") get called?
When does this @Scheduled(cron = "0 0 0/24 * * ?") get called?

Time:09-07

I found this @Scheduled(cron = "0 0 0/24 * * ?") on top of a scheduler. Also there was a comment saying this runs every day. But i am not convinced how.

I know that Cron expression looks like

<minute> <hour> <day-of-month> <month> <day-of-week> <command>

But I am not able to relate 0/24 to . Can anyone add here?

CodePudding user response:

Refer to Spring Docs. Spring's Cron expression is different with linux. It's look like:

<Seconds> <Minutes> <Hours> <DayofMonth> <Month> <DayofWeek> <Year>

0/24 mean start at 0 o'clock and repeat it after 24 hours

CodePudding user response:

Cron expression:

<Seconds> <Minutes> <Hours> <Day Of Month> <Month> <Day Of Week> <Year>

You can refer to:

* * * ? * * Every second

0 * * ? * * Every minute

0 0 13 * * ? At 13:00:00pm every day

0 0 */6 ? * * Every six hours

0 0 * ? * * Every hour

  • Related