增量式备份
This commit is contained in:
parent
d76c0ecfc3
commit
c1af7cb7b3
@ -43,14 +43,11 @@ cd $backUpPath
|
||||
# 更新上次备份的binlog文件名和位置
|
||||
echo "$CURRENT_BINLOG $CURRENT_POSITION" > "last_backup.txt"
|
||||
|
||||
backup_files=()
|
||||
|
||||
cd $backUpPath
|
||||
find ${dbName}-incremental-*.sql.zip -type f -print0 | while IFS= read -r -d '' file; do
|
||||
file_date=$(stat -c %Y "$file")
|
||||
current_time=$(date +%s)
|
||||
if (( (current_time - file_date) > 86400 )); then
|
||||
backup_files+=("$file")
|
||||
OLD_BACKUPS=()
|
||||
for file in ${backUpPath}/${dbName}-incremental--*.sql.zip; do
|
||||
file_date=$(echo "$file" | grep -oP "(?<=-$dbName-)\d{10}(?=.sql.zip)")
|
||||
if [[ $((CURRENT_DATE - file_date)) -gt 600 ]]; then
|
||||
OLD_BACKUPS+=("$file")
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user