清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
适用于Linux平台下的一个定时备份压缩数据库代码
压缩备份Mysql数据库
#!/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!\n" 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!\n" 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 \n"; tar -zcvf $backRenRenFile $backRenRenDb echo -e "Backup File "$backRenRenFile" Done!\n" tar -zcvf $back4399File $back4399Db echo -e "Back File "$back4399File" Done \n"; tar -zcvf $backManyouFile $backManyouDb echo -e "Back File "$backManyouFile" Done \n"; 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