Script works fine from CLI, but not when Cron'd
craig001 at lerwick.hopto.org
Tue Oct 7 09:30:52 UTC 2008
On Tue, 2008-10-07 at 10:20 +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?
> Script as follows:
> mysqldump --opt -h localhost -u $USER -p$PASS horbury_dppd06
> And that's it...
> When run as root from CLI, works with no errors. When run from cron as
> root, get the "not found" problem.
> Marc A Coyles - Horbury School ICT Support Team
> Mbl: 07850 518106
> Land: 01924 282740 ext 730
> Helpdesk: 01924 282740 ext 2000
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
When it is run from cron it is not picking up the shell .profile so PATH
is not set. As mysqldump is sitting in a directory in one of the paths
Quick fix use full path details in the mysqldump line.
Source in a .profile .... to set the paths.
More information about the freebsd-questions