十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
#!/bin/bash
为土默特右旗等地区用户提供了全套网页设计制作服务,及土默特右旗网站建设行业解决方案。主营业务为成都网站制作、成都网站建设、土默特右旗网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
Begin=date +"%Y年%m月%d日 %H:%M:%S"
BakDir=/home/backup/backup
LogFile=/home/backup/backup/bak.log
Date=date +%Y%m%d
cd $BakDir
DumpFile=$Date.sql
BZDumpFile=$Date.sql.tar.bz2
/usr/bin/MySQLdump -u数据库登录帐号 -p数据库密码 --all-databases > $DumpFile
/bin/tar jvcf $BZDumpFile $DumpFile
/bin/rm $DumpFile
openssl enc -k 备份加密密码 -aes-128-ecb -e -in $BZDumpFile -out $BZDumpFile-aes
#-d 解密
/bin/rm $BZDumpFile
Last=date +"%Y年%m月%d日 %H:%M:%S"
echo "">>$LogFile
echo "---------fullybak--------">>$LogFile
echo "$BZDumpFile-aes copying">>$LogFile
echo 开始:$Begin 结束:$Last $BZDumpFile-aes succ >> $LogFile
#!/bin/bash
Begin=date +"%Y年%m月%d日 %H:%M:%S"
BakDir=/home/backup/backup
LogFile=/home/backup/backup/bak.log
Date=date +%Y%m%d
cd $BakDir
echo "">>$LogFile
echo "---------scp--------">>$LogFile
if (test -e $Date.sql.tar.bz2-aes)
then
scp $BakDir/$Date.sql.tar.bz2-aes backup@10.0.0.22:/home/backup/backup55
if [ "$?" = "0" ]
then
echo "$Date.sql.tar.bz2-aes sending...">>$LogFile
else
echo "scp failed...">>$LogFile
fi
else
echo "$Date.sql.tar.bz2-aes not exist!">>$LogFile
fi
if (test -e $Date.tar.bz2-aes)
then
scp $BakDir/$Date.tar.bz2-aes backup@10.0.0.22:/home/backup/backup55
if [ "$?" = "0" ]
then
echo "$Date.tar.bz2-aes sending...">>$LogFile
else
echo "scp failed...">>$LogFile
fi
else
echo "$Date.tar.bz2-aes not exist!">>$LogFile
fi
Last=date +"%Y年%m月%d日 %H:%M:%S"
echo 开始:$Begin 结束:$Last succ >> $LogFile
#!/bin/bash
Begin=date +"%Y年%m月%d日 %H:%M:%S"
LogFile=/home/backup/backup/bak.log
BakDir=/home/backup/backup
cd $BakDir
oldBakDir0=date -d '-35 days' +%Y%m%d
.tar.bz2-aes
oldBakDir1=date -d '-34 days' +%Y%m%d
.tar.bz2-aes
oldBakDir2=date -d '-33 days' +%Y%m%d
.tar.bz2-aes
oldBakDir3=date -d '-32 days' +%Y%m%d
.tar.bz2-aes
oldBakDir4=date -d '-31 days' +%Y%m%d
.tar.bz2-aes
oldBakDir5=date -d '-30 days' +%Y%m%d
.tar.bz2-aes
oldBakDir6=date -d '-29 days' +%Y%m%d
.tar.bz2-aes
oldBakFile=date -d '-35 days' +%Y%m%d
.sql.tar.bz2-aes
Date=date +%Y%m%d
GZDumpFile=$Date.sql.tar.bz2-aes
echo "">>$LogFile
echo "---------rm--------">>$LogFile
if (test -e $GZDumpFile)
then
if (test -e $oldBakDir0)
then
rm -rf $oldBakDir0
echo "delete increased sql $oldBakDir0" >> $LogFile
else
echo "$oldBakDir0 not exist!" >> $LogFile
fi
if (test -e $oldBakDir1)
then
rm -rf $oldBakDir1
echo "delete increased sql $oldBakDir1" >> $LogFile
else
echo "$oldBakDir1 not exist!" >> $LogFile
fi
if (test -e $oldBakDir2)
then
rm -rf $oldBakDir2
echo "delete increased sql $oldBakDir2" >> $LogFile
else
echo "$oldBakDir2 not exist!" >> $LogFile
fi
if (test -e $oldBakDir3)
then
rm -rf $oldBakDir3
echo "delete increased sql $oldBakDir3" >> $LogFile
else
echo "$oldBakDir3 not exist!" >> $LogFile
fi
if (test -e $oldBakDir4)
then
rm -rf $oldBakDir4
echo "delete increased sql $oldBakDir4" >> $LogFile
else
echo "$oldBakDir4 not exist!" >> $LogFile
fi
if (test -e $oldBakDir5)
then
rm -rf $oldBakDir5
echo "delete increased sql $oldBakDir5" >> $LogFile
else
echo "$oldBakDir5 not exist!" >> $LogFile
fi
if (test -e $oldBakDir6)
then
rm -rf $oldBakDir6
echo "delete increased sql $oldBakDir6" >> $LogFile
else
echo "$oldBakDir6 not exist!" >> $LogFile
fi
if (test -e $oldBakFile)
then
rm -rf $oldBakFile
echo "delete full sql $oldBakFile" >> $LogFile
else
echo "$oldBakFile not exist!" >> $LogFile
fi
else
echo "Warning:There is no backup today!!" >> $LogFile
fi
Last=date +"%Y年%m月%d日 %H:%M:%S"
echo 开始:$Begin 结束:$Last succ >> $LogFile
0 23 0 /bin/sh /home/backup/Mysql-FullyBak.sh > /home/backup/cronlog.txt 2>&1
45 23 0 /bin/sh /home/backup/rmBak.sh > /home/backup/cronlog.txt 2>&1
30 23 * /bin/sh /home/backup/scpBak.sh > /home/backup/cronlog.txt 2>&1
#! /bin/bash
username=root
ps='TH'
mysql_data="/home/mysql_backup/data"/lvshan.sql
password=echo $ps|base64 -d
mysql_zip="/home/mysql_backup/data"/lvshan_zip.zip
mysql_back="/home/mysqlbackup/data"/lvshandata +%Y_%m_%d
.zip
/usr/bin/mysqldump --opt -u$username -p$password -hlocalhost lvshan > $mysql_data
/bin/zip $mysql_zip $mysql_data
/bin/rm $mysql_data
openssl enc -k 备份加密密码 -aes-128-ecb -e -in $mysql_zip -out $mysql_back
/bin/rm $mysql_zip
scp -P 6008 $mysql_back root@ip:/home/mysql_backup_lvshan_ip