Cron job question

Matthew Seaman m.seaman at
Fri Aug 22 10:42:43 PDT 2003

On Fri, Aug 22, 2003 at 07:18:16PM +0200, Rick Hoekman wrote:
> I am getting this message every 5 minutes. Can somebody explain to me
> why root apparently is not found here?
> X-Original-To: root at
> Delivered-To: root at
> From: root at (Cron Daemon)
> To: root at
> Subject: Cron <root at somedomain> root /usr/libexec/atrun
> X-Cron-Env: <SHELL=/bin/sh>
> X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
> X-Cron-Env: <HOME=/root>
> X-Cron-Env: <LOGNAME=root>
> X-Cron-Env: <USER=root> Date: Fri, 22 Aug
> 2003 19:05:00 +0200 (CEST) root: not found

You've made the classic mistake of confusing the system crontab
(/etc/crontab) and the user specific crontabs that live in
/var/cron/tabs.  These are quite different files.

The system crontab /etc/crontab is not user specific: thus it has an
extra column defining which user ID the command should be run as.  In
general you shouldn't need to touch this file at all -- it's where
standard stuff like the 'at' queue, newsyslog and the
daily/weekly/monthly periodic functions are run from.  If you must
alter this file, just edit it directly: cron(8) will pick up the
changes in a minute or so.  In particular you do not need to use
crontab(1) to manage this file.

The per-user crontabs are what you would expect if you're familiar
with the SysV or Linux style cron(8) daemon.  Each user has their own
crontab file, which is managed using the crontab(1) command.  In
general it's a good policy to use the per-user crontab stuff to add
any new cron jobs for any user (including root) and leave the system
/etc/crontab in it's default state.

The error you're seeing suggests to me that what you've done is run
crontab(1) on /etc/crontab, and the extra column containing the userid
is being interpreted as a command that cron should run.  However,
there is no command 'root', hence the error message.  To fix, make
sute that /etc/crontab contains the default contents by copying over
/usr/src/etc/crontab or running mergemaster(1).  Backup and delete the
root crontab you've generated:

    # crontab -l -u root > /tmp/root.crontab
    # crontab -r -u root

Now, if root.crontab contains substantively the same as /etc/crontab,
you're done.  Otherwise, if you need to add some extra root cron jobs,
edit /tmp/root.crontab to strip out the default stuff, leaving only
you extra jobs.  Don't put a username in column 6 of the file: rather
that should be the last column and contain the command to run, as per
crontab(5).  Once edited to your liking load the new crontab file into
the system:

    # vi /tmp/root.crontab
    # crontab -u root /tmp/root.crontab



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list