From 19ce92eb78ddd9fa87835bd2442f6c326c7f13a5 Mon Sep 17 00:00:00 2001 From: Ze'ev Schurmann Date: Sat, 16 Nov 2024 20:23:57 +0200 Subject: [PATCH] v1.01 of autoswap.sh - Fixed bug correcting SWAP file sizes. --- swap-management/autoswap.service | 2 +- swap-management/autoswap.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swap-management/autoswap.service b/swap-management/autoswap.service index 78ae308..707707b 100644 --- a/swap-management/autoswap.service +++ b/swap-management/autoswap.service @@ -1,5 +1,5 @@ [Unit] -Description=Auto SWAP Service v1.0 (Bash Version) +Description=Auto SWAP Service v1.01 (Bash Version) [Service] ExecStart=/autoswap.sh diff --git a/swap-management/autoswap.sh b/swap-management/autoswap.sh index e1643c4..8a6890c 100644 --- a/swap-management/autoswap.sh +++ b/swap-management/autoswap.sh @@ -1,7 +1,7 @@ #!/bin/bash ## autoswap.sh -## version 1.0 +## version 1.01 ## Automatically add and remove SWAP files based on system load. ## Author: Ze'ev Schurmann @@ -124,10 +124,10 @@ fi swap_file_size_gb=$(($swap_file_size/1024)) -if [[ $(($swap_file_size%1024)) -eq 0 ]]; then +if [[ $(($swap_file_size%1024)) != 0 ]]; then echolog "Converting {swap_file_size} from MB to GB, rounding up..." ((swap_file_size_gb++)) - swap_file_size=$(($swap_file_size_gb*1014)) + swap_file_size=$(($swap_file_size_gb*1024)) fi echolog "{threshold_minimum} = ${threshold_minimum}MB"