Archive : Mt use 75% of free ram.
This commit is contained in:
parent
5a490bb555
commit
fe3e84babf
|
@ -32,7 +32,7 @@ function archive() {
|
||||||
_iterate_targets process ${targets[@]}
|
_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.
|
# All directories by default.
|
||||||
# Supports .archiveignore exclude file.
|
# Supports .archiveignore exclude file.
|
||||||
# Usage: archive_mt [DIRS]
|
# Usage: archive_mt [DIRS]
|
||||||
|
@ -54,7 +54,7 @@ function archive_mt() {
|
||||||
|
|
||||||
# Determine memory limit.
|
# Determine memory limit.
|
||||||
local mem_free=$(_mem_free)
|
local mem_free=$(_mem_free)
|
||||||
local mem_limit=$((mem_free/2))
|
local mem_limit=$((mem_free*3/4))
|
||||||
|
|
||||||
# create archive.
|
# 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)
|
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)
|
||||||
|
|
|
@ -21,7 +21,7 @@ Command|Description
|
||||||
Command|Description
|
Command|Description
|
||||||
---|---
|
---|---
|
||||||
`archive [DIRS]`|Archive directories. All directories by default. Supports .archiveignore exclude file.
|
`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_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_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.
|
`archive_prune [NAME] [VERSIONS]`|Delete old versions of an archive. All archives with 1 version by default.
|
||||||
|
|
Reference in a new issue