I want to run some code during fixed schedule every 15 minute every day that runs from 10 pm to 6 am and not run on 3rd and 25th of every month
Here is what I have
@Scheduled(cron = "0 0/15 0-6,22-24 * * *")
public void runJob() {
// ...
}
0/15 - for every mins
0-6, 22-24 - assuming this runs every day from midnight to 6 am and then again from 10 pm to midnight (Is it correct)
The only thing I cant figure out is how can I say this does not run on certain dates like 3rd and 25th of every month.
Should I put something like 1,3-23,26-31 in day of month field so its something like this
0 0/15 0-6,22-24 1,4-23,26-31 * *
You can declare analytically what you want in such a complex scenario. The following should work.
Or you can summarize it a bit into
For hour
24
is represented as0