From owner-freebsd-questions@FreeBSD.ORG Sat Jan 7 14:30:29 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7318E106564A for ; Sat, 7 Jan 2012 14:30:29 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id EBFAF8FC15 for ; Sat, 7 Jan 2012 14:30:28 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [IPv6:2001:8b0:151:1:fa1e:dfff:feda:c0bb]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.5/8.14.5) with ESMTP id q07EUMvW023003 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sat, 7 Jan 2012 14:30:23 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: OpenDKIM Filter v2.4.1 smtp.infracaninophile.co.uk q07EUMvW023003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1325946623; bh=KMwiAR0WNz+oIIYTlxQZYCGe05ByZVZexlZMTu5rWQY=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Cc; b=O40AaSHhpOjRSIsYmDMbTfsip6X5x4vdKP2x3cQ/ufCsHuc+ZFeTS26Zan+CaRZ6r xqXx3MMO78DLdrJfs0dyYhgzVXIZSMTlyjhevEnxe4vm4fQ9Yt5dwT+Ma3NjbPPh4t 6UBXyqEKnqL62AARNqhNQuuxXvJCgujPSiG/hr6Y= Message-ID: <4F0856F6.1060207@infracaninophile.co.uk> Date: Sat, 07 Jan 2012 14:30:14 +0000 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4F0838DF.40006@gmail.com> <20120107132234.31d04a1c@gumby.homeunix.com> <4F084AAD.3050301@gmail.com> <20120107135743.6aa5a6bd@gumby.homeunix.com> In-Reply-To: <20120107135743.6aa5a6bd@gumby.homeunix.com> X-Enigmail-Version: 1.3.4 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig4788070ACC52CF3D71C56869" X-Virus-Scanned: clamav-milter 0.97.3 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk Subject: Re: Having problems running shell script from crontab X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 14:30:29 -0000 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 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--