[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] backup script



Hi,

I'm trying to do a backup script for MySQL databases.
This script do :

 - dump of the base with a "today" file name
 - compress the base (tar.gz)
 - open ftp connection
 - put the file
 - close de ftp connection
 - delete the file

When I launch this script with root session, everything works fine.
But when I put the script in crontab job, everything works fine ... but dump file is empty!!!

Here is the script :


===================begin
#!/bin/sh

BASENAME="motorstv"
FILENAME=$BASENAME.`date +%Y%m%d`_`date +%H%M`.dump

/usr/bin/mysqldump $BASENAME --add-drop-table > $FILENAME
/bin/gzip $FILENAME
FILENAME=$FILENAME.gz

ftp -n <<EOF
open 62.23.47.225
user sauvegarde backup99
cd /ibays/backup/files/
put $FILENAME
bye
EOF

rm -f $FILENAME
===================end


Thanks a lot for your help.

IS