summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbackup-progress.in13
1 files changed, 10 insertions, 3 deletions
diff --git a/backup-progress.in b/backup-progress.in
index c5cb655..61f8c1e 100755
--- a/backup-progress.in
+++ b/backup-progress.in
@@ -15,16 +15,23 @@ for backupID in "${!backups[@]}"; do
| tail -n1
)
last_size=$(
- du -s "${dir}/${last}" \
+ du -sb "${dir}/${last}" \
| awk '{print $1}'
)
current_size=$(
- du -s "${dir}/aktuell" \
+ du -sb "${dir}/aktuell" \
| awk '{print $1}'
)
+ size="${current_size}"
+ for unit in '' k M G T P Y; do
+ if [ "${size}" -lt 1024 ]; then
+ break
+ fi
+ size=$((size/1024))
+ done
percentage=$(
printf '100*%s/%s\n' "${current_size}" "${last_size}" \
| bc -l
)
- printf '%6.2f %% %s\n' "${percentage}" "${backupID}"
+ printf '%6.2f %% (%s %sB) %s\n' "${percentage}" "${size}" "${unit}" "${backupID}"
done