Fixed bug with saving swap settings

This commit is contained in:
Jason Hee committed 2016-12-07 16:49:42 +08:00
1 parent 803b2ce2eb
commit febdd604b5
2 files changed
+9 -3

No files matched your search

+1 -1
View File
@@ -57,7 +57,7 @@ function setupSwap() {
createSwap
mountSwap
tweakSwapSettings "10" "50"
saveSwapSettings
saveSwapSettings "10" "50"
}
function hasSwap() {
+8 -2
View File
@@ -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