aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/files_integrity_croncheck.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/files_integrity_croncheck.sh b/scripts/files_integrity_croncheck.sh
index 0cf99d8..01b4951 100755
--- a/scripts/files_integrity_croncheck.sh
+++ b/scripts/files_integrity_croncheck.sh
@@ -23,8 +23,15 @@ mkdir -p "$output_dir"
for dir in "${dirs[@]}"; do
basefn="$(printf "%s\n" "$dir" | sed 's:/:_:g;s/^_//;s/_$//')"
outputfn="$output_dir/${basefn}_$(date +%F_%T).md5sum.gz"
+ outputlistfn="$output_dir/${basefn}.tmplist"
- find "$dir"/ -type f -print0 | sort -z | xargs -0 md5sum -b \
+ # store file list: it avoids having the complete list in memory for all
+ # the time the md5sums processes will take to complete which can be
+ # consequent.
+ ionice -c 3 nice -n 19 find "$dir"/ -type f -print0 | sort -z \
+ > "$outputlistfn"
+
+ xargs --arg-file="$outputlistfn" -0 ionice -c 3 nice -n 19 md5sum -b \
| gzip -9 > "$outputfn"
diff_two_last_by_mail \