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?
Asked
Active
Viewed 2,721 times
2

Mureinik
- 297,002
- 52
- 306
- 350

user3116949
- 265
- 1
- 5
- 14
-
2Try replacing `0/30` with `15,45` (no space after comma). This will run 15 and 45 minutes after every hour. – Paradox Aug 18 '16 at 16:40
-
Possible duplicate of [Run Cron job every N minutes plus offset](http://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset) – fedorqui Aug 19 '16 at 07:54
2 Answers
1
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 * ? *

Mureinik
- 297,002
- 52
- 306
- 350
0
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.

Paradox
- 4,602
- 12
- 44
- 88