[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: crontab hour range 6-midnight



On Thu, Dec 01, 2011 at 12:19:06PM +0100, Jochen Spieker wrote:
> Nicolas Bercher:
> > 
> > I'd like use set up a crontab rule from 6 am to midnight, and crontab(5) mentions:
> >   field          allowed values
> >   hour           0-23
> > 
> > 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
like:

  */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.

-- 
Darac Marjal

Attachment: signature.asc
Description: Digital signature


Reply to: