From owner-freebsd-questions@FreeBSD.ORG Tue Oct 7 09:30:52 2008 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 6D8051065686 for ; Tue, 7 Oct 2008 09:30:52 +0000 (UTC) (envelope-from craig001@lerwick.hopto.org) Received: from lerwick.hopto.org (81-178-20-70.dsl.pipex.com [81.178.20.70]) by mx1.freebsd.org (Postfix) with SMTP id 58A298FC19 for ; Tue, 7 Oct 2008 09:30:50 +0000 (UTC) (envelope-from craig001@lerwick.hopto.org) Received: (qmail 65147 invoked by uid 98); 7 Oct 2008 10:28:37 +0100 Received: from 192.168.0.2 by polaris.lerwick.hopto.org (envelope-from , uid 82) with qmail-scanner-2.01 (clamdscan: 0.88.4/1789. hbedv: 7.1.1.11/6.35.1.178. f-prot: 4.6.6/3.16.14. spamassassin: 3.1.4. Clear:RC:1(192.168.0.2):. Processed in 6.865735 secs); 07 Oct 2008 09:28:37 -0000 Received: from main.lerwick.hopto.org (HELO ?192.168.0.2?) (192.168.0.2) by lerwick.hopto.org with SMTP; 7 Oct 2008 10:28:30 +0100 From: Craig Butler To: mcoyles@horbury.wakefield.sch.uk In-Reply-To: <003001c9285d$f2a3a410$d7eaec30$@wakefield.sch.uk> References: <003001c9285d$f2a3a410$d7eaec30$@wakefield.sch.uk> Content-Type: text/plain Date: Tue, 07 Oct 2008 10:30:25 +0100 Message-Id: <1223371831.54577.3.camel@main.lerwick.hopto.org> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Script works fine from CLI, but not when Cron'd 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: Tue, 07 Oct 2008 09:30:52 -0000 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