From 1e60ca2eb65883546c260258c5d41550dde7ac24 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Tue, 22 Apr 2025 22:19:16 +0800 Subject: [PATCH] feat: add source size calculation to backup script - Introduce SOURCE_SIZE variable in cm-script.yaml - Remove redundant SOURCE_SIZE calculation This change calculates the size of the data directory prior to initiating the backup process. It ensures that the backup script has accurate information about the size of the source data, enhancing the logging and monitoring of backup activities. --- backups/daemonset+cronjob/cm-script.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backups/daemonset+cronjob/cm-script.yaml b/backups/daemonset+cronjob/cm-script.yaml index cd24b4e..5508678 100644 --- a/backups/daemonset+cronjob/cm-script.yaml +++ b/backups/daemonset+cronjob/cm-script.yaml @@ -21,6 +21,7 @@ data: HOSTNAME="${NODE_NAME:-$HOSTNAME}" FEISHU_WEBHOOK_URL=$(cat /etc/feishu-webhook/url) + SOURCE_SIZE=$(du -sh /data/local-csi | cut -f1) START_TIME=$(date +%s) @@ -54,7 +55,6 @@ data: TIMESTAMP=$(date +%Y-%m-%d-%H-%M-%S) BACKUP_NAME="backup-${DIR_NAME}-${TIMESTAMP}.tar.gz" BACKUP_PATH="/tmp/${BACKUP_NAME}" - SOURCE_SIZE=$(du -sh /data/local-csi | cut -f1) echo "正在备份目录: $dir"