diff --git a/README.md b/README.md index 9884980..2af7c06 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,8 @@ How did the sync occur, cron job or manually via ssh? This is auto detected and ### dusum_human_readable_total_file Path to save a grand total of each disk usage sum in human readable form. -### dusum_byte_total_file -Path to save a grand total of each disk usage sum in bytes. +### dusum_kbytes_total_file +Path to save a grand total of each disk usage sum in killo bytes. ## Module specific configurations Each module is configured via configurations prefixed by the module name. The one configuration used by all modules is the `_sync_method` configuration which defines what sync method to use. Each sync method has different configurations available. The default sync method is rsync. diff --git a/mirror-sync.sh b/mirror-sync.sh index 6a1f082..c71f358 100644 --- a/mirror-sync.sh +++ b/mirror-sync.sh @@ -286,43 +286,43 @@ log_end_header() { # Build dsum totals files if defined. rebuild_dusum_totals() { - # Rebuild byte total. - if [[ $dusum_byte_total_file ]]; then + # Rebuild killo byte total. + if [[ $dusum_kbytes_total_file ]]; then { date - totalBytes=0 + totalKBytes=0 for MODULE in ${MODULES:?}; do eval dusum="\${${MODULE}_dusum:-}" if [[ -n $dusum ]]; then while read -r size path; do if [[ -n $size ]]; then - totalBytes=$((totalBytes+size)) + totalKBytes=$((totalKBytes+size)) printf "%-12s %s\n" "$size" "$path" fi done < "$dusum" fi done - printf "%-12s %s\n" "$totalBytes" "total" - } > "$dusum_byte_total_file" + printf "%-12s %s\n" "$totalKBytes" "total" + } > "$dusum_kbytes_total_file" fi # Rebuild human readable total. if [[ $dusum_human_readable_total_file ]]; then { date - totalBytes=0 + totalKBytes=0 for MODULE in ${MODULES:?}; do eval dusum="\${${MODULE}_dusum:-}" if [[ -n $dusum ]]; then while read -r size path; do if [[ -n $size ]]; then - totalBytes=$((totalBytes+size)) - printf "%-5s %s\n" "$(numfmt --to=iec <<<"$size")" "$path" + totalKBytes=$((totalKBytes+size)) + printf "%-5s %s\n" "$(echo "$size*1024" | bc | numfmt --to=iec)" "$path" fi done < "$dusum" fi done - printf "%-5s %s\n" "$(numfmt --to=iec <<<"$totalBytes")" "total" + printf "%-5s %s\n" "$(echo "$totalKBytes*1024" | bc | numfmt --to=iec)" "total" } > "$dusum_human_readable_total_file" fi }