Update memory.sh

This commit is contained in:
Kroese 2025-10-17 13:03:34 +02:00 committed by GitHub
parent 1d649239ed
commit fbf900332e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@
set -Eeuo pipefail
RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}')
if [[ "$RAM_CHECK" != [Nn]* && "${RAM_SIZE,,}" != "max" && "${RAM_SIZE,,}" != "half" ]]; then
AVAIL_MEM=$(formatBytes "$RAM_AVAIL")
@ -59,15 +59,15 @@ if [[ "${RAM_SIZE,,}" == "max" ]]; then
RAM_WANTED=$(( RAM_WANTED / 1073741825 ))
if (( "$RAM_WANTED" < 1 )); then
RAM_WANTED=$(( RAM_AVAIL - RAM_SPARE ))
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
if (( "$RAM_WANTED" < 1 )); then
RAM_WANTED=$(( RAM_AVAIL ))
RAM_WANTED=$(( RAM_WANTED / 1048577 ))
fi
RAM_SIZE="${RAM_WANTED}M"
@ -80,7 +80,7 @@ if [[ "${RAM_SIZE,,}" == "max" ]]; then
else
RAM_SIZE="${RAM_WANTED}G"
fi
fi
return 0