if [ ! -d $BackupPath ]; then mkdir $BackupPath fi echo "---------------------------" echo $(date +"%y-%m-%d %H:%M:%S") echo "---------------------------" MySQL 定时数据备份中删除历史文件
if [ -f $OldFile ]; then rm -f $OldFile >> $LogFile echo "[$OldFile]Delete Old File Success!" else echo "not exist old file!" fi 新文件
if [ -f $NewFile ]; then echo "[$NewFile] The Backup File is exists,Can't Backup! " else MySQLdump -u $DBUser $DBName > $DumpFile tar czvf $NewFile $DumpFile rm -rf $DumpFile echo "[$NewFile]Backup Success!" fi 以上的相关内容就是对MySQL 定时数据备份的介绍,望你能有所收获。