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

Re: cron: how ? WAS: cron: why not?



On Fri, Sep 07, 2001 at 01:58:10AM +0200, Martin F Krafft wrote:
> 
> crontab(5):
>        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 current time.  For exam­
>        ple,
>        ``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.
> 

I was about to reply and point out the above characteristic of crontab
behaviour.  I'd still like to know if anyone knows how to get the behaviour
that Martin wants.  I'm in the midst of setting up a crontab entry myself
and can't see a way around crontab using whatever matches from either the
dom and dow fields.  

Suppose one wants a command to run on the third of every month at 8:30 am,
and only then. Neither "30 8 3 * * <command>" nor "30 8 3 * 0 <command>"
will work according to the crontab(5) exerpt above.  The first will cause it
to run on the third, and every day of the week of every month.  The second
will cause the command to run on the third and on every Sunday.  

What value does one put in the dow field so that it is null ?

The same is true if one wants a command run on a given day of the week, and
only on that day.  Suppose the command is to run on Monday only.  
"30 8 * * 1 <command>" will cause the command to run on Monday, but also
every other day of the month.  "30 8 <1-31> * 1 <command>" will cause the
command to run every Monday, but also on whatever date one used in the dom
field.  

Anyone know if there is a way around this ?

Thanks,

G.



Reply to: