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

Re: crontab hour range 6-midnight

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

But beware that you probably need to use /full/path/to/my-script. $PATH
is probably not what you expect.

> As a more generic question: can we define rules that spans hours,
> days, etc. writing ranges "n-m" where m<n?

I cannot tell from reading crontab(5). Try it.

> Cant' find such answers (except by experiencing a lot... and waiting a lot!).

Just try the it with minutes instead of hours.

> Moreover, crontab is happily "installing new crontab" when I use such
> rules, but they don't seem to be treated at all.

You should your job in /var/log/syslog.

I wish I was gay.
[Agree]   [Disagree]

Attachment: signature.asc
Description: Digital signature

Reply to: