From 9c209cfcc13b5d9dab36d2b458b814e366f5bd41 Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Sun, 24 Mar 2024 15:01:26 +0100 Subject: [PATCH] tb to gb --- backup-node.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backup-node.sh b/backup-node.sh index 409a4b4d..6aa1f867 100755 --- a/backup-node.sh +++ b/backup-node.sh @@ -18,15 +18,19 @@ for key in $keys; do sub(/[Kk]$/, "", size) # Remove 'K' suffix if present sub(/[Mm]$/, "", size) # Remove 'M' suffix if present sub(/[Gg]$/, "", size) # Remove 'G' suffix if present + sub(/[Tt]$/, "", size) # Remove 'T' suffix if present if ($1 ~ /[Kk]$/) { size *= 0.001 # Convert kilobytes to gigabytes } else if ($1 ~ /[Mm]$/) { size *= 0.001 # Convert megabytes to gigabytes + } else if ($1 ~ /[Tt]$/) { + size *= 1000 # convert terabytes to gigabytes } print size "G" }') target_file="/backup/rpc_$key-$(date +'%Y-%m-%d-%H-%M-%S')-$folder_size.tar.zst" + #echo "$target_file" tar -cf - "$source_folder" | pv -pterb -s $(du -sb "$source_folder" | awk '{print $1}') | zstd -o "$target_file" done