crontab - Run a cron job every 5 minutes between two times
2014-01
Is there a way to specify a job that runs every 5 minutes between some start time and some end time on business days in a crontab?
Update I think it's relevant that my start and end times are not at round hours. So, specifying 9-5 in the hour column isn't enough. I want 9:30-17:30.
You'll have to do it piecewise:
30-59/5 9 * * * script.sh
*/5 10-16 * * * script.sh
0-30/5 17 * * * script.sh
Simple question- what would a crontab entry look like for a command I want to run every week on Saturday at 8:05 AM?
That should do it:
5 8 * * 6 <user> <command>
documentation (man 5 crontab
):
field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 (0 or 7 is Sun, or use names)
Sat 8:05AM run find
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
5 8 * * Sat /usr/bin/find
These answers are all correct, if you are unaware of how to use cron in the future, use one of many cron generators.
From extensive investigation of "man 5 crontab", it looks like this'll do the trick:
5 8 * * sat /usr/bin/man 5 crontab
5 8 * * 6 *your command*
You can also do like this:
Change crontab:
5 8 * * * <user> cd / && run-parts --report /etc/cron.daily
And put all your command scripts in this directory /etc/cron.daily. Make sure that you have added the execution rights for them.