Date: Sat, 07 Jan 2012 14:30:14 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: freebsd-questions@freebsd.org Subject: Re: Having problems running shell script from crontab Message-ID: <4F0856F6.1060207@infracaninophile.co.uk> In-Reply-To: <20120107135743.6aa5a6bd@gumby.homeunix.com> References: <4F0838DF.40006@gmail.com> <20120107132234.31d04a1c@gumby.homeunix.com> <4F084AAD.3050301@gmail.com> <20120107135743.6aa5a6bd@gumby.homeunix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig4788070ACC52CF3D71C56869 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 07/01/2012 13:57, RW wrote: > On Sat, 07 Jan 2012 15:37:49 +0200 > Kaya Saman wrote: >=20 > n terms of paths this is what I'm doing: I'm in a FreeBSD jail >> logged in by - #jexec <jail> tcsh >> >> which gets me in as root. Crontab is being run as root so paths >> should be the same no? No -- you can't assume that. The correct thing to do is to set $PATH within your script, then it should stand a much improved chance of running correctly irrespective of how it gets started. Add a line like this near the top of the script: export PATH=3D/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbi= n That should be good enough for most purposes, but feel free to modify if needed. Another debugging tip: add set -x or set -v -x towards the top of the script and you'll get a trace of what the script does e-mailed to you. (Well, e-mailed to root, but I assume yould've been reading root's mailbox anyhow, or redirected the root e-mails to somewhere more useful.) > PATH is set at the top of /etc/crontab Well, yes. However that only helps for the scripts run out of /etc/crontab. If the OP has done the right thing and left /etc/crontab alone, but instead set up a root crontab by running # crontab -u root -e then that wouldn't help at all. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enig4788070ACC52CF3D71C56869 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8IVv4ACgkQ8Mjk52CukIzG3ACfaCFjTzX/coX7d0DOPON6w6R2 nu8AoIh2OKOy/Y+6wQn6sM9PgsqNzKxB =WVT1 -----END PGP SIGNATURE----- --------------enig4788070ACC52CF3D71C56869--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F0856F6.1060207>