圧縮バックアップMysqlデータベース

1873 ワード

[1].[  ]     Mysql       [1]
#!/bin/bash
shijie=`date +%Y%m%d`
backRenRenDb=renren_minishijie$shijie.sql
back4399Db=4399_minishijie$shijie.sql
backManyouDb=Manyou$shijie.sql
backRenRenFile=renren$shijie.tar.gz
back4399File=file4399$shijie.tar.gz
backManyouFile=Manyou$shijie.tar.gz
password=123456
cd /var/www/back
mysqldump -uroot -p$password --default-character-set=utf8 --opt --extended-insert=false --triggers -R --hex-blob --single-transaction renren > $backRenRenDb
echo -e "Backup "$backRenRenDb" DONE!
" mysqldump -uroot -p$password --default-character-set=utf8 --opt --extended-insert=false --triggers -R --hex-blob --single-transaction 4399 > $back4399Db echo -e "Backup "$back4399Db" DOne!
" mysqldump -uroot -p$password --default-character-set=utf8 --opt --extended-insert=false --triggers -R --hex-blob --single-transaction manyou > $backManyouDb echo -e "Backup "$backManyouDb" DONE
"; tar -zcvf $backRenRenFile $backRenRenDb echo -e "Backup File "$backRenRenFile" Done!
" tar -zcvf $back4399File $back4399Db echo -e "Back File "$back4399File" Done
"; tar -zcvf $backManyouFile $backManyouDb echo -e "Back File "$backManyouFile" Done
"; rm -f $backManyouDb rm -f $backRenRenDb rm -f $back4399Db echo -e "Backup Done" #ftp upload ftphost=192.168.1.1 ftpuser=test ftppass=test ftp -n $ftphost <<END_SCRIPT user $ftpuser $ftppass passive put $backRenRenFile $backRenRenFile bye END_SCRIPT http://hi.baidu.com/jxvip/blog/item/197e3df3c6a95c5f352accd9.html