summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbackup-progress.in10
-rw-r--r--backup.conf3
2 files changed, 11 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
diff --git a/backup.conf b/backup.conf
index 8d7fd4e..63e3ec5 100644
--- a/backup.conf
+++ b/backup.conf
@@ -37,3 +37,6 @@ recognSubdirRegex="home\|boot\|root\|erich"
# directory for caching valuable information in backup-statistics
cacheDir="/path/to/cache/directory"
+
+# timeout for `du` in backup-progress [seconds]
+du_timeout=10