NYCPHP Meetup

NYPHP.org

[nycphp-talk] [ot] mysqldump cron problem

Hans Zaunere lists at zaunere.com
Sun Feb 19 11:12:30 EST 2006



Hans Kaspersetz wrote on Sunday, February 19, 2006 7:41 AM:
> I created a bash script that is supposed to dump one of my databases.
> When I run the bash script from the cli it dumps no problem.  When I
> call the script from cron, I get an empty file in the destination
> directory.  Anyone have any ideas?
> 
> FreeBSD 5.3
> MySQL 4.1
> 
> --------------------------------
> #!/usr/local/bin/bash
> path="/usr/local/backups/"
> 
> date=`date +"%y%m%d-%H%M%S"`
> filename=$path$date"-oncellrx.sql"
> 
> mysqldump --opt -Q -uUSER -pPASS DATABASE > $filename
> ------------------------------------
> 
> I am calling the script as myself from cron.  Bash is set as my shell in
> passwd.  Seems sorta mysterious to me.

Probably a permissions or path problem... first do:

which mysqldump

and then use the absolute path of mysqldump in the script.

H




More information about the talk mailing list