summaryrefslogtreecommitdiff
path: root/backup-progress.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-10 22:36:04 +0100
committerErich Eckner <git@eckner.net>2019-02-10 22:36:04 +0100
commit314ad8d94c5ff33fd2eadb1027748550be0e7e4f (patch)
treeb94d525ac5758380cbc8cbcc8bce8e5b68823697 /backup-progress.in
parent080efe8cbf8e5bc69a17f8af8f5feffd01dd67fe (diff)
downloadhardlinkedBackups-314ad8d94c5ff33fd2eadb1027748550be0e7e4f.tar.xz
camelCase -> no-camel-case, backup-progress new
Diffstat (limited to 'backup-progress.in')
-rwxr-xr-xbackup-progress.in30
1 files changed, 30 insertions, 0 deletions
diff --git a/backup-progress.in b/backup-progress.in
new file mode 100755
index 0000000..c5cb655
--- /dev/null
+++ b/backup-progress.in
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+. #ETCDIR#/backup.conf
+
+export LC_ALL=C
+
+for backupID in "${!backups[@]}"; do
+ [ -s "/tmp/${backupID}.pid" ] || continue
+ kill -0 $(cat "/tmp/${backupID}.pid") || continue
+ dir="${backups["${backupID}"]%% *}"
+ last=$(
+ ls -1 "$dir" \
+ | grep '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}' \
+ | sort \
+ | tail -n1
+ )
+ last_size=$(
+ du -s "${dir}/${last}" \
+ | awk '{print $1}'
+ )
+ current_size=$(
+ du -s "${dir}/aktuell" \
+ | awk '{print $1}'
+ )
+ percentage=$(
+ printf '100*%s/%s\n' "${current_size}" "${last_size}" \
+ | bc -l
+ )
+ printf '%6.2f %% %s\n' "${percentage}" "${backupID}"
+done