*/15 0-2,8-23 * * * test.sh
─┬── ───┬──── ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (all)
│ │ │ └─────── month (all)
│ │ └───────── day of month (all)
│ └─────────────── hour (between 0-2 and between 8-23)
└────────────────────── min (every 15 minutes)
Run every 15 minutes, from 12:00am to 02:45am and from 08:00am to 23:45 of every day.
0-2,8-23
is equivalent to 0,1,2,8,9,10,...,23
while */15
is equivalent to 0,15,30,45
.
The above will not include 03:00, because the last execution would be 02:45; if we use 0-3 instead of 0-2, it would have also executed at 03:15,30,45.
To be able to include also 03:00,(02:59 actually) we need to be a bit more verbose:
14,29,44,59 0-2,8-23 * * * test.sh