You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
579 B

#!/bin/bash
# 备份目录
backup_path="/usr/local/Backup"
# 备份日期
date_str=`date +%Y%m%d`
# 备份的目录名称
backup_path=/usr/local/Backup/base_db_${date_str}
# 备份的文件名称
FILE=${backup_path}.tar.gz
# 备份
rm -rf ${backup_path}
mariabackup --backup --target-dir ${backup_path} --databases="base_db mysql" --user root --password DsideaL147258369
# 压缩目录
tar -czf ${FILE} ${backup_path}
# 删除临时目录
rm -rf ${backup_path}
# 切片
split -b 100m -d ${FILE} ${FILE}.
# 删除原文件
rm -rf ${FILE}