Re: crontab hour range 6-midnight
Darac Marjal a écrit :
On Thu, Dec 01, 2011 at 12:19:06PM +0100, Jochen Spieker wrote:
I'd like use set up a crontab rule from 6 am to midnight, and crontab(5) mentions:
field allowed values
Then, I tried something like:
*/10 6-0 * * 1-5 my-script
Using this, cron should execute my-script on 06:10, 06:20 … 23:50, 00:00, 00:10 …
00:50. What you probably want is
*/10 6-23 * * * my-script
In addition to the above, remember that it's possible to supply lists to
cron fields. If you want to span midnight, you probably want something
*/10 0,6-23 * * * my-script
Though this will run every 10 mins in the hours 00:00, 06:00, 07:00
etc. Again, probably not what you want. 6-23 will probably be best.
Thanks you two, things get clearer now because I was thinking about
numbers as boundaries instead of durations.
So you were both right, what fits my needs the best is probably
"*/10 6-23 * * 1-5"