Reputation: 5753
I need two cron jobs and I am really not sure if I am doing right. One con job should run every 01.01.xxx at 01:00 o'clock and the other should run every night at 01:00.
@Scheduled(cron = "0 0 01 01 01 ?") // every year 01.01 at 01:00 o'clock
@Scheduled(cron = "0 0 01 * * *") // very day at 01:00 o'clock
Are these the correct expression?
Upvotes: 1
Views: 5267
Reputation: 5829
Yes.
The pattern is a list of six single space-separated fields: representing second, minute, hour, day, month, weekday. Month and weekday names can be given as the first three letters of the English names.
Every day syntax is "sec min hour * * *"
Once a year syntax is "sec min hour day_of_month month ?"
(Normally "01" is written as "1")
Spring cron expression for every day 1:01:am
Upvotes: 1