diff options
author | Erich Eckner <git@eckner.net> | 2019-09-11 13:46:06 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-09-11 13:46:06 +0200 |
commit | 9408e3e88a3f0e2f50c6dbb1aa0c02cd22ac9401 (patch) | |
tree | 7ffb4b0bd74f66c768396ccddb1e0134cafbd4cf /backup-progress.in | |
parent | 0ac8bd369c3247b0687c0bdd20f8275d5c545022 (diff) | |
download | hardlinkedBackups-9408e3e88a3f0e2f50c6dbb1aa0c02cd22ac9401.tar.xz |
backup-progress: time out `du` after $du_timeout seconds
Diffstat (limited to 'backup-progress.in')
-rwxr-xr-x | backup-progress.in | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/backup-progress.in b/backup-progress.in index 90492fb..4e67f92 100755 --- a/backup-progress.in +++ b/backup-progress.in @@ -26,13 +26,19 @@ for backupID in "${!backups[@]}"; do | tail -n1 ) last_size=$( - du -sb "${dir}/${last}" \ + timeout ${du_timeout} du -sb "${dir}/${last}" \ | awk '{print $1}' ) + if [ -z "${last_size}" ]; then + last_size='4096' + fi current_size=$( - du -sb "${dir}/aktuell" \ + timeout ${du_timeout} du -sb "${dir}/aktuell" \ | awk '{print $1}' ) + if [ -z "${current_size}" ]; then + current_size='0' + fi size="${current_size}" decimal='' for unit in '' k M G T P Y; do |