Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2008 02:32:26 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        Marc Coyles <mcoyles@horbury.wakefield.sch.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Script works fine from CLI, but not when Cron'd
Message-ID:  <20081007093226.GA44366@icarus.home.lan>
In-Reply-To: <003001c9285d$f2a3a410$d7eaec30$@wakefield.sch.uk>
References:  <003001c9285d$f2a3a410$d7eaec30$@wakefield.sch.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 07, 2008 at 10:20:32AM +0100, Marc Coyles wrote:
> I've got a script to backup my MySQL databases, which works absolutely
> fine from the command line, but when I add it in to root's cronjobs it
> always fails with "mysqldump: not found" - what am I doing wrong?

mysqldump is in /usr/local/bin, which $PATH does not contain when
running from a cronjob.  (PATH inside of cron has a very limited scope,
I believe it's /bin:/usr/bin).

Either set PATH to include /usr/local/bin, or just refer to the
fully-qualified path of mysqldump (/usr/local/bin/mysqldump).

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081007093226.GA44366>