Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jun 2003 21:30:32 -0400
From:      Bill Moran <wmoran@potentialtech.com>
To:        Mike McGrath <silver-fox@mn.rr.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Cron wacking out
Message-ID:  <3EEFC0B8.7070704@potentialtech.com>
In-Reply-To: <GDEBLLAOCAACOFHIIFOLGECKCCAA.silver-fox@mn.rr.com>
References:  <GDEBLLAOCAACOFHIIFOLGECKCCAA.silver-fox@mn.rr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Mike McGrath wrote:
> Hi -
> 
> 
> Right now I have a problem with my crontab.
> 
> Here is the crontab file.
> 
> silver-fox# crontab -l
> # /etc/crontab - root's crontab for FreeBSD
> #
> # $FreeBSD: src/etc/crontab,v 1.21.2.3 2000/12/08 10:56:07 obrien Exp $
> #
> SHELL=/bin/sh
> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
> HOME=/var/log
> #
> #minute hour    mday    month   wday    who     command
> #
> */5     *       *       *       *       root    /usr/libexec/atrun
> #
> # rotate log files every hour, if necessary
> 0       *       *       *       *       root    newsyslog
> #
> # do daily/weekly/monthly maintenance
> 1       3       *       *       *       root    periodic daily
> 15      4       *       *       6       root    periodic weekly
> 30      5       1       *       *       root    periodic monthly
> #
> # time zone change adjustment for wall cmos clock,
> # does nothing, if you have UTC cmos clock.
> # See adjkerntz(8) for details.
> 1,31    0-5     *       *       *       root    adjkerntz -a
> 
> 
> I keep getting these emails
> 
> Message 5:
>>From root@silver-fox.us Tue Jun 17 00:20:00 2003
> Date: Tue, 17 Jun 2003 00:20:00 -0500 (CDT)
> From: root@silver-fox.us (Cron Daemon)
> To: root@silver-fox.us
> Subject: Cron <root@silver-fox> 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>
> 
> root: not found
> 
> And the log file /var/log/crontab
> 
> Jun 17 00:20:00 silver-fox /usr/sbin/cron[246]: (root) CMD
> (/usr/libexec/atrun)
> Jun 17 00:20:00 silver-fox /usr/sbin/cron[247]: (root) CMD
> (root^I/usr/libexec/atrun)
> Jun 17 00:20:23 silver-fox crontab[253]: (root) LIST (root)
> 
> So I see that ^I and root and what I am assuming is the CMD, which it really
> should not be. If I am right the cron is trying to run /usr/libexec/atrun as
> user root and not part of the command. I just don't get it. I have tried to
> edit the crontab with crontab -e and even copied a new file over from
> /usr/src/etc/crontab and then did crontab crontab to get updated. I'm lost.

It looks like you've copied the system crontab to roots crontab.  It
appears as though the system is trying to run the command
"root /usr/libexec/atrun", which doesn't exist, while at the same time
the system crontab is running normally (thus the messages in your
crontab log).
The system crontab has the "user" field in it, so it can run commands
as any user.
Each user's crontab is missing that field (even root's) because it
would be a security breach to allow users to change the user that
their cronjobs ran under.
To edit the system crontab, use your favorite editor to edit /etc/crontab.
This file should have 7 fields.  The 6th is the user to run the command
as.
To edit root's crontab, log in as root and enter 'crontab -e'.  This
crontab should only have 6 fields and all commands always run as root.
root's crontab is treated just like any other user's.
For more information, see the various man pages on crontabs.

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EEFC0B8.7070704>