增量式备份
This commit is contained in:
parent
a0b213c3f6
commit
6adab45ce3
@ -42,13 +42,14 @@ cd $backUpPath
|
|||||||
echo "$CURRENT_BINLOG $CURRENT_POSITION" > "last_backup.txt"
|
echo "$CURRENT_BINLOG $CURRENT_POSITION" > "last_backup.txt"
|
||||||
|
|
||||||
backup_files=()
|
backup_files=()
|
||||||
while IFS= read -r -d '' file; do
|
|
||||||
|
find "$BACKUP_DIR" -name "$DB_NAME-*.sql.gz" -type f -print0 | while IFS= read -r -d '' file; do
|
||||||
file_date=$(stat -c %Y "$file")
|
file_date=$(stat -c %Y "$file")
|
||||||
current_time=$(date +%s)
|
current_time=$(date +%s)
|
||||||
if (( (current_time - file_date) > 86400 )); then
|
if (( (current_time - file_date) > 86400 )); then
|
||||||
backup_files+=("$file")
|
backup_files+=("$file")
|
||||||
fi
|
fi
|
||||||
done << (find "$BACKUP_DIR" -name ${backUpPath}/${dbName}-incremental-*.sql.gz" -type f -print0)
|
done
|
||||||
|
|
||||||
# 遍历数组,打印每个文件名
|
# 遍历数组,打印每个文件名
|
||||||
for file in "${backup_files[@]}"; do
|
for file in "${backup_files[@]}"; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user