Reputation: 55
How do you run a cron job every minute only between office hours(10 am to 5pm)
I checked this thread Run a cron job every minute only on specific hours? but it doesn't answer my questions.
Upvotes: 4
Views: 10832
Reputation: 11290
* 10-16 * * * /path/to/executable/file argument_1 argument_2
Yes, you can define hours range.
Someone tried to edit my answer but as documentation says hours in range are inclusive http://team.macnn.com/drafts/crontab_defs.html so don't change 16 to 17.
Upvotes: 1
Reputation: 42885
This should be correct:
* 10-16 * * 1-5 /path/to/my-script
So every single minute, between and including 10am and 5pm, every day in every month that is a day between and including monday to friday. Obviously "office hours" is a fuzzy expression, many people have other schedules ;-)
Unfortunately I fail to see an easy solution to get the script executed also exactly on 5pm...
Upvotes: 11
Reputation: 7
It does,
Access your shell script and add the following
* 10-17 * * *
This means run every min, between these hours, on every day, of every month etc
Upvotes: -1