分类:
2005-12-27 17:02:10
我的MYSQL备份及FTP远程再备份脚本。
#!/bin/sh
date=`date +%Y%m%d-%H%M%S`
echo -e "mysqldump starting......"
mysqldump --opt -r /mysql-bak/backupdir.$date.sql -umysql -pyourpassword databasename
cd /mysql-bak
tar czvf backupdir.$date.sql.tar.gz backupdir.$date.sql
rm -fr backupdir.$date.sql
echo -e "mysqldump finished!"
sleep 3
#ftp
ftp -in <
user ftpuser 123456
passive
prompt=off
binary
cd /home/vsftpuser/mysql-bak
lcd /mysql-bak
mput backupdir.$date.sql.tar.gz
bye
EOF