Cron job question
Rick Hoekman
rick at paranoia.nl
Fri Aug 22 10:50:05 PDT 2003
Hello Matthew,
Thank you for taking the time explaining it to me!
Rick
Friday, August 22, 2003, 7:41:59 PM, you wrote:
MS> 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 somedomain.nl
>> Delivered-To: root at hoekmansysteembeheer.nl
>> From: root at somedomain.nl (Cron Daemon)
>> To: root at hoekmansysteembeheer.nl
>> 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
>>
MS> You've made the classic mistake of confusing the system crontab
MS> (/etc/crontab) and the user specific crontabs that live in
MS> /var/cron/tabs. These are quite different files.
MS> The system crontab /etc/crontab is not user specific: thus it has an
MS> extra column defining which user ID the command should be run as. In
MS> general you shouldn't need to touch this file at all -- it's where
MS> standard stuff like the 'at' queue, newsyslog and the
MS> daily/weekly/monthly periodic functions are run from. If you must
MS> alter this file, just edit it directly: cron(8) will pick up the
MS> changes in a minute or so. In particular you do not need to use
MS> crontab(1) to manage this file.
MS> The per-user crontabs are what you would expect if you're familiar
MS> with the SysV or Linux style cron(8) daemon. Each user has their own
MS> crontab file, which is managed using the crontab(1) command. In
MS> general it's a good policy to use the per-user crontab stuff to add
MS> any new cron jobs for any user (including root) and leave the system
MS> /etc/crontab in it's default state.
MS> The error you're seeing suggests to me that what you've done is run
MS> crontab(1) on /etc/crontab, and the extra column containing the userid
MS> is being interpreted as a command that cron should run. However,
MS> there is no command 'root', hence the error message. To fix, make
MS> sute that /etc/crontab contains the default contents by copying over
MS> /usr/src/etc/crontab or running mergemaster(1). Backup and delete the
MS> root crontab you've generated:
MS> # crontab -l -u root > /tmp/root.crontab
MS> # crontab -r -u root
MS> Now, if root.crontab contains substantively the same as /etc/crontab,
MS> you're done. Otherwise, if you need to add some extra root cron jobs,
MS> edit /tmp/root.crontab to strip out the default stuff, leaving only
MS> you extra jobs. Don't put a username in column 6 of the file: rather
MS> that should be the last column and contain the command to run, as per
MS> crontab(5). Once edited to your liking load the new crontab file into
MS> the system:
MS> # vi /tmp/root.crontab
MS> # crontab -u root /tmp/root.crontab
MS> Cheers,
MS> Matthew
More information about the freebsd-questions
mailing list