#!/bin/bash
為土默特右旗等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及土默特右旗網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站制作、成都網(wǎng)站建設(shè)、土默特右旗網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!
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數(shù)據(jù)庫登錄帳號 -p數(shù)據(jù)庫密碼 --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 結(jié)束:$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 結(jié)束:$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 結(jié)束:$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