diff options
Diffstat (limited to 'backupStatistics.in')
-rw-r--r-- | backupStatistics.in | 16 |
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}:" |