Subject: Re: cron / crontab mystery
To: None <netbsd-users@NetBSD.org>
From: Mike Parson <mparson@bl.org>
List: netbsd-users
Date: 06/18/2004 08:48:22
On Thu, Jun 17, 2004 at 03:36:10AM +0200, Magnus Eriksson wrote:
> 
> Hi.
> 
>   I'm on a 1.6 system.  /etc/daily runs each day (night) at 3.15, and
> /etc/weekly at 4.30, as in the original installation.
> 
>   Now I find this annoying, since I'm often at the machine, using it at
> 3.15, so I thought I'd change it.
> 
>   I started editing /var/cron/tabs/root, to set the times to 9.15 and
> 10.30 instead (when I'm either not at home or still asleep).  I saved and
> then decided to try crontab -e (edit), so I did.  My changes were
> obviously there, so I saved and figured that was that.

You should always use crontab -e to edit your tabs.  NetBSD's cron
might deal with it properly, but historically, and for cross-platorm
functionality, best practices, and all taht, use the cron tools to edit
your crontab.

>   Now, looking at the time of this message, I suppose you all can figure
> out what happened at 3.15 ?

Guess it still ran? =)

>   The man page for cron seems to say I did everything I had to:
> 
> 
>        Additionally, cron checks each minute to see if its  spool
>        directory's  modtime  (or the modtime on /etc/crontab) has
>        changed, and if it has, cron will then examine the modtime
>        on all crontabs and reload those which have changed.  Thus
>        cron need not be restarted whenever a crontab file is mod-
>        ified.   Note that the crontab(1) command updates the mod-
>        time of the spool directory whenever it changes a crontab.
> 
> 
>   crontab -l (as root) shows the changes, and they are (still) present in
> /var/cron/tabs/root .
> 
> 
>   Is the error in the cron, in the manpage, or in my understanding of the
> whole thing?

Seeing as how you did fire up crontab -e, I would figure that this
should have been enough.  You might want to run it one more time, but
make some sort of a change, even if you change it back, so that when you
exit the editor, it writes out a new file.  Also, you can try sending
crond a HUP, which should force it to re-read all tabs.

-- 
Michael Parson
mparson@bl.org