NetBSD-Users archive

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

Re: crontab fun

Patrick Welche wrote:
Quoting the fine crontab(5) manual:

       Note: The day of a command's execution can be specified by  two  fields
       --  day  of month, and day of week.  If both fields are restricted (ie,
       aren't *), the command will be run when either field matches  the  cur-
       rent time.  For example,
       ``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st
       and 15th of each month, plus every Friday.

How can you run a command when _both_ fields match?

Don't know, but obviously there coult be a need for it.

If the rule were _both_ and I wanted _either_, I could write 2 lines
in crontab. The opposite isn't obvious to me. A use case for _both_
would be "run this backup every Friday unless it's the first of the
month (because the different monthly backup is running)" - and I can't
believe I'm the first one to encounter this ;-)

Replacing that with two lines is not equivalent. If both match, you would then get the command run twice, which might not be what was wanted either.

Obviously if you could express both variants, that would be best.
As it is now, I guess the easiest way is having a script run by the command, which checks of the other condition also is met, and if not, just finish.


Home | Main Index | Thread Index | Old Index