summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-10-19 12:35:13 +0200
committerErich Eckner <git@eckner.net>2016-10-19 12:35:13 +0200
commitf071994bbc0c0c9593bd7b8d7e40b244a498a95d (patch)
tree96ede186fac2c75694382d121d79ab68d2f770e7
parent903564349edb8e2ef457a5dbf09d3ed9c9c206f5 (diff)
downloadhardlinkedBackups-f071994bbc0c0c9593bd7b8d7e40b244a498a95d.tar.xz
backupStatistics verwendet jetzt mehrere tmpDirs
-rw-r--r--backupStatistics.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/backupStatistics.in b/backupStatistics.in
index b0a0062..4ba66d2 100644
--- a/backupStatistics.in
+++ b/backupStatistics.in
@@ -2,6 +2,8 @@
# backupStatistics version #VERSION#
+set -e
+
[ -r "#ETCDIR#/backup.conf" ] && \
. "#ETCDIR#/backup.conf"
@@ -37,8 +39,11 @@ do_stage()
echo 'sort previous lists by $inode'
return 0
fi
- sort -u "${cacheDir}/${backupID}.inodes" > \
+ tmpDirA="$(mktemp -d)"
+ tmpDirB="$(mktemp -d "${cacheDir}/tmp.XXXXXX")"
+ sort -T "${tmpDirA}" -T "${tmpDirB}" -u "${cacheDir}/${backupID}.inodes" > \
"${cacheDir}/${backupID}.inodes.sorted"
+ rmdir "${tmpDirA}" "${tmpDirB}"
;;
3)
if [ "$2" == '##DESCRIBE##' ]
@@ -46,13 +51,16 @@ do_stage()
echo 'generate lists $inode -> $contentHash'
return 0
fi
+ tmpDirA="$(mktemp -d)"
+ tmpDirB="$(mktemp -d "${cacheDir}/tmp.XXXXXX")"
uniq -m1 "${cacheDir}/${backupID}.inodes.sorted" | \
parallel \
sha512sum {=s/^[[:digit:]]\+ //=} \| \
sed "\"s|^\([0-9a-f]\{128\}\) .*\$|\1 "{=s/^\([[:digit:]]\+\) .*/\\1/=}"|\"" \
\; | \
- sort > \
+ sort -T "${tmpDirA}" -T "${tmpDirB}" > \
"${cacheDir}/${backupID}.content"
+ rmdir "${tmpDirA}" "${tmpDirB}"
;;
4)
if [ "$2" == '##DESCRIBE##' ]
@@ -195,9 +203,9 @@ then
usage
fi
-for ((stage=${skipNum}-1; stage<=${maxNum}; stage++))
+for ((stage=${skipNum}+1; stage<=${maxNum}; stage++))
do
- echo "entering stage ${stage} ..."
+ echo "entering stage ${stage} ($(do_stage ${stage} '##DESCRIBE##')) ..."
for backupID in "${!backups[@]}"
do
echo "${backupID}:"