From 529ba993a295177a1f7b48bf99cdb9c8641cb60b Mon Sep 17 00:00:00 2001 From: desktop Date: Tue, 9 Jan 2024 01:36:46 +0300 Subject: [PATCH] Archive : Mt use 75% of free ram. --- .config/bash/module/Archive.sh | 4 ++-- .doc/Bash.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/bash/module/Archive.sh b/.config/bash/module/Archive.sh index ffbcca6..6808b13 100644 --- a/.config/bash/module/Archive.sh +++ b/.config/bash/module/Archive.sh @@ -32,7 +32,7 @@ function archive() { _iterate_targets process ${targets[@]} } -# Archive using multiple threads. Uses 50% of free RAM. +# Archive using multiple threads. Uses 75% of free RAM. # All directories by default. # Supports .archiveignore exclude file. # Usage: archive_mt [DIRS] @@ -54,7 +54,7 @@ function archive_mt() { # Determine memory limit. local mem_free=$(_mem_free) - local mem_limit=$((mem_free/2)) + local mem_limit=$((mem_free*3/4)) # create archive. local hash=$(tar ${exclude} -c ${target} | pv -s $(/usr/bin/du -sb ${target} | awk '{print $1}') | xz -9e --threads=0 --memlimit=${mem_limit}MiB | tee ${name}.txz | sha1sum | cut -d\ -f1) diff --git a/.doc/Bash.md b/.doc/Bash.md index 4737276..432742f 100644 --- a/.doc/Bash.md +++ b/.doc/Bash.md @@ -21,7 +21,7 @@ Command|Description Command|Description ---|--- `archive [DIRS]`|Archive directories. All directories by default. Supports .archiveignore exclude file. -`archive_mt [DIRS]`|Archive using multiple threads. Uses 50% of free RAM. All directories by default. Supports .archiveignore exclude file. +`archive_mt [DIRS]`|Archive using multiple threads. Uses 75% of free RAM. All directories by default. Supports .archiveignore exclude file. `archive_fast [DIRS]`|Archive directories with fast compression. All directories by default. Supports .archiveignore exclude file. `archive_check [FILES]`|Check archives integrity. Checks all archives by default. `archive_prune [NAME] [VERSIONS]`|Delete old versions of an archive. All archives with 1 version by default.