From febdd604b5aa11679418f9ff1fc7e5ae4e9394c7 Mon Sep 17 00:00:00 2001 From: Jason Hee Date: Wed, 7 Dec 2016 16:49:42 +0800 Subject: [PATCH] Fixed bug with saving swap settings --- setup.sh | 2 +- setupLibrary.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 6b61629..84af15c 100644 --- a/setup.sh +++ b/setup.sh @@ -57,7 +57,7 @@ function setupSwap() { createSwap mountSwap tweakSwapSettings "10" "50" - saveSwapSettings + saveSwapSettings "10" "50" } function hasSwap() { diff --git a/setupLibrary.sh b/setupLibrary.sh index ef621e6..8f15eec 100644 --- a/setupLibrary.sh +++ b/setupLibrary.sh @@ -91,9 +91,15 @@ function tweakSwapSettings() { } # Save the modified swap settings +# Arguments: +# new vm.swappiness value +# new vm.vfs_cache_pressure value function saveSwapSettings() { - echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf - echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf + local swappiness=${1} + local vfs_cache_pressure=${2} + + echo "vm.swappiness=${swappiness}" | sudo tee -a /etc/sysctl.conf + echo "vm.vfs_cache_pressure=${vfs_cache_pressure}" | sudo tee -a /etc/sysctl.conf } # Set the machine's timezone