From 314ad8d94c5ff33fd2eadb1027748550be0e7e4f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 10 Feb 2019 22:36:04 +0100 Subject: camelCase -> no-camel-case, backup-progress new --- backup-progress.in | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 backup-progress.in (limited to 'backup-progress.in') 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 -- cgit v1.2.3-54-g00ecf