From beff899e5ff4940598def317d1ab8726c95f42b5 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Fri, 31 May 2024 09:03:01 +0200 Subject: [PATCH] [enh] Configure swappiness --- helpers/helpers.v1.d/hardware | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helpers/helpers.v1.d/hardware b/helpers/helpers.v1.d/hardware index 071cd2f72..3183de04c 100644 --- a/helpers/helpers.v1.d/hardware +++ b/helpers/helpers.v1.d/hardware @@ -130,6 +130,13 @@ ynh_add_swap () { return fi + # Configure swappiness + if [ ! -e /etc/sysctl.d/999-ynhswap.conf ] + then + echo "vm.swappiness=10" > /etc/sysctl.d/999-ynhswap.conf + sysctl --quiet --system + fi + # Compare the available space with the size of the swap. # And set a acceptable size from the request if [ $usable_space -ge $swap_max_size ]