diff options
author | Erich Eckner <git@eckner.net> | 2019-02-10 22:36:04 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-02-10 22:36:04 +0100 |
commit | 314ad8d94c5ff33fd2eadb1027748550be0e7e4f (patch) | |
tree | b94d525ac5758380cbc8cbcc8bce8e5b68823697 /backup-progress.in | |
parent | 080efe8cbf8e5bc69a17f8af8f5feffd01dd67fe (diff) | |
download | hardlinkedBackups-314ad8d94c5ff33fd2eadb1027748550be0e7e4f.tar.xz |
camelCase -> no-camel-case, backup-progress new
Diffstat (limited to 'backup-progress.in')
-rwxr-xr-x | backup-progress.in | 30 |
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 |