Date: Sun, 03 Sep 2006 09:39:12 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Noah <admin2@enabled.com> Cc: freebsd-questions@freebsd.org Subject: Re: crontab entries not executing Message-ID: <44FA94B0.1070301@infracaninophile.co.uk> In-Reply-To: <44FA5AEE.3040100@enabled.com> References: <44FA5AEE.3040100@enabled.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Noah wrote:
> I just rebuilt a new 5.5 server and I am finding root's crontab entries
> are not being executed. any body got some clues about how I can
> troubleshoot this issue so my cron entries are bring executed.
Verify that root's crontab does anything at all by running a simple
command every minute. Eg. use 'crontab -u root -e' to add this
line to the root crontab:
*/1 * * * * /usr/bin/touch /tmp/foo
Then if you do 'ls -l /tmp/foo' you should see the timestamp changing
every minute. Remember to remove this line once you're done testing.
If it doesn't, check that cron is enabled and running. It is enabled
by default in /etc/defaults/rc.conf.
Examine /var/log/cron -- everything cron tries to run should be logged
there.
However, I suspect that the problem is the standard gotcha when using
cron. Scripts run from cron get a very minimal environment. In
particular you *will* need to set the PATH explicitly at the top of
your script. Something like this generally suffices:
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/local/sbin
export PATH
Or else use fully qualified paths for any programs you call from the
script.
This is the primary cause of programs that work fine under test when
run from your login account but that do not work when run from cron.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard
Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
Kent, CT11 9PW
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE+pS38Mjk52CukIwRCNQyAJ92bJ4vXsNfN0ghqQgf1vZZidB1agCdHbgb
VXHATTLVUEFAyFPK+liJrg0=
=QspJ
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44FA94B0.1070301>
