Date: Tue, 07 Oct 2008 10:30:25 +0100 From: Craig Butler <craig001@lerwick.hopto.org> To: mcoyles@horbury.wakefield.sch.uk Cc: freebsd-questions@freebsd.org Subject: Re: Script works fine from CLI, but not when Cron'd Message-ID: <1223371831.54577.3.camel@main.lerwick.hopto.org> 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, 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: > > #!/bin/sh > USER= > PASS= > > mysqldump --opt -h localhost -u $USER -p$PASS horbury_dppd06 > >/home/horbury/backup_mysql/dppd06.sql > > > 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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@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 (/usr/local/bin ??) Quick fix use full path details in the mysqldump line. Or Source in a .profile .... to set the paths. Regards Craig B
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1223371831.54577.3.camel>