v1.01 of autoswap.sh - Fixed bug correcting SWAP file sizes.

This commit is contained in:
ZAKS Web 2024-11-16 20:23:57 +02:00
parent 5b9cad82b3
commit 19ce92eb78
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Auto SWAP Service v1.0 (Bash Version) Description=Auto SWAP Service v1.01 (Bash Version)
[Service] [Service]
ExecStart=/autoswap.sh ExecStart=/autoswap.sh

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
## autoswap.sh ## autoswap.sh
## version 1.0 ## version 1.01
## Automatically add and remove SWAP files based on system load. ## Automatically add and remove SWAP files based on system load.
## Author: Ze'ev Schurmann ## Author: Ze'ev Schurmann
@ -124,10 +124,10 @@ fi
swap_file_size_gb=$(($swap_file_size/1024)) 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..." echolog "Converting {swap_file_size} from MB to GB, rounding up..."
((swap_file_size_gb++)) ((swap_file_size_gb++))
swap_file_size=$(($swap_file_size_gb*1014)) swap_file_size=$(($swap_file_size_gb*1024))
fi fi
echolog "{threshold_minimum} = ${threshold_minimum}MB" echolog "{threshold_minimum} = ${threshold_minimum}MB"