From 6adab45ce35fa2351ca4c9da86e7ccd88d1c7667 Mon Sep 17 00:00:00 2001 From: "zhangkun9038@dingtalk.com" Date: Sat, 15 Jul 2023 22:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E9=87=8F=E5=BC=8F=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backUpIncremental.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backUpIncremental.sh b/backUpIncremental.sh index 8d6b43f..f8ebb46 100755 --- a/backUpIncremental.sh +++ b/backUpIncremental.sh @@ -42,13 +42,14 @@ cd $backUpPath echo "$CURRENT_BINLOG $CURRENT_POSITION" > "last_backup.txt" 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") current_time=$(date +%s) if (( (current_time - file_date) > 86400 )); then backup_files+=("$file") fi -done << (find "$BACKUP_DIR" -name ${backUpPath}/${dbName}-incremental-*.sql.gz" -type f -print0) +done # 遍历数组,打印每个文件名 for file in "${backup_files[@]}"; do