I have a difficulty writing a cron expression to schedule events Mon-Saturday every 15 minutes from 4:30 am to 8:30 am.
Thanks.
I have a difficulty writing a cron expression to schedule events Mon-Saturday every 15 minutes from 4:30 am to 8:30 am.
Thanks.
I don't think that you can solve this problem in one step, so a usable strategy might be to first coarse-filter via crontab:
0,15,30,45 4,5,6,7,8 * * 1,2,3,4,5,6 /do-whatever
which is almost OK, it will just execute 4:00 4:15 and 8:45, so we filter these at the start of the executed script:
# Too early? Then get out
if [ `date +%H%M` -lt 430 ] ; then
exit 0
fi
# Too late? Then get out
if [ `date +%H%M` -gt 830 ] ; then
exit 0
fi
# start of the original script
....
It will take 3 separate Quartz cron expressions to define the times exactly as you want them.
Edited to add: This Quartz cron expression gets you from 4 am to 8:45 am, just as fvu's answer does.