Bug 21660

Summary: crontab mishandles day range
Product: Base System Reporter: wayne <wayne>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.5-STABLE   
Hardware: Any   
OS: Any   

Description wayne 2000-09-30 16:50:02 UTC
The following crontab line is intended to execute only on the 2d Friday
of every month, but it executes every Friday morning.
8 8 8-14 * 5 mail -s "Pickup request" eoates < /home/wayne/mail/biohazard.mai

How-To-Repeat: Put the following line into your crontab, with you instead of eoates as
recipient, and with the name of an existing short text file (such as
a copy of this email) after the <

Line to put in using the command 'crontab -e' "
8 8 8-14 * 5 mail -s "Pickup request" eoates < /home/wayne/mail/biohazard.mai

Then, wait until Friday.  If you get the message, and the day of the month
is not in the range 8-14, you have the problem, too.
Comment 1 Peter Wemm freebsd_committer freebsd_triage 2000-10-02 20:02:01 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

misfiled PR
Comment 2 Gerhard Sittig 2001-01-13 19:31:18 UTC
On Sat, Sep 30, 2000 at 10:55 -0500, wayne@barnes1.wustl.edu wrote:
> 
> >Synopsis:       crontab mishandles day range
> >Release:        FreeBSD 3.5-STABLE i386
> >Description:
> The following crontab line is intended to execute only on the
> 2d Friday of every month, but it executes every Friday morning.
> 8 8 8-14 * 5 mail -s "Pickup request" eoates < /home/wayne/mail/biohazard.mai

Could you please check your system's crontab(5) manpage?  Here it
looks like this:

-----------------------------------------------------------------
%uname -sr
FreeBSD 4.2-STABLE
%man 5 crontab
[ ... ]
     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.
[ ... ]
-----------------------------------------------------------------

The part of "either field" is emphasized.  If your manpage tells
you the same, it seems that you have to find a different method
of specifying your intension.  The easiest would probably be to
wildcard the DOW part and wrap your mail command into a script
which quickly checks `date '+%w'` output to be 5.


virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
Gerhard Sittig   true | mail -s "get gpg key" Gerhard.Sittig@gmx.net
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.
Comment 3 unfurl freebsd_committer freebsd_triage 2001-05-30 06:21:27 UTC
State Changed
From-To: open->closed

This was never a problem to begin with, just a misunderstanding of how 
crontab works.