Reputation: 275
I am currently trying to generate a cron expression that runs every 30 minutes throughout the day but at hours like 10:15, 10:45, 11:15 and so on. I know that the cron expression 0 0/30 * 1/1 * ? *
runs every 30 minutes but it does it at 10:00, 10:30, 11:00, 11:30 and so on. I wanted to know if there is a way to create a cron expression that would run at hours like 9:15, 9:45, 10:15, 10:45 and so on, like in quarter hour periods?
Upvotes: 2
Views: 3222
Reputation: 4566
Instead of:
0 0/30 * 1/1 * ? *
Use:
0 15,45 * 1/1 * ? *
This will run 15 and 45 minutes after every hour, resulting in the desired times 9:15, 9:45, 10:15, 10:45, etc.
Upvotes: 0
Reputation: 311853
Running every 30 minutes starting with 15 minutes after the hour is just running twice an hour - at :15 and at :45. So instead of over-complicating, just have list those two options with a comma:
0 15,45 * 1/1 * ? *
Upvotes: 1