Date: Fri, 22 Aug 2003 18:41:59 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Rick Hoekman <rick@paranoia.nl> Cc: freebsd-questions@freebsd.org Subject: Re: Cron job question Message-ID: <20030822174159.GA93473@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <144352351144.20030822191816@paranoia.nl> References: <144352351144.20030822191816@paranoia.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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? >=20 >=20 > X-Original-To: root@somedomain.nl > Delivered-To: root@hoekmansysteembeheer.nl > From: root@somedomain.nl (Cron Daemon) > To: root@hoekmansysteembeheer.nl > Subject: Cron <root@somedomain> root /usr/libexec/atrun > X-Cron-Env: <SHELL=3D/bin/sh> > X-Cron-Env: <PATH=3D/etc:/bin:/sbin:/usr/bin:/usr/sbin> > X-Cron-Env: <HOME=3D/root> > X-Cron-Env: <LOGNAME=3Droot> > X-Cron-Env: <USER=3Droot> Date: Fri, 22 Aug > 2003 19:05:00 +0200 (CEST) root: not found >=20 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 Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --Q68bSM7Ycu6FN28Q Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/RlXndtESqEQa7a0RAj1nAJwOP51vnh/R7IiIlEvg33HndPAGzwCfb9Cr /TZc195ioKGsk/3RWlSVObw= =yd/K -----END PGP SIGNATURE----- --Q68bSM7Ycu6FN28Q--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030822174159.GA93473>