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