Created
October 28, 2020 22:52
-
-
Save victorwpbastos/855950eb28f230b61df6820b11d2bd6a to your computer and use it in GitHub Desktop.
Script para habilitar swap em servidores Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'Enabling swap...' | |
fallocate -l 1G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
cp /etc/fstab /etc/fstab.bak | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
sysctl vm.swappiness=10 | |
sysctl vm.vfs_cache_pressure=50 | |
cp /etc/sysctl.conf /etc/sysctl.conf.bak | |
echo 'vm.swappiness=10' >> /etc/sysctl.conf | |
echo 'vm.vfs_cache_pressure=50' >> /etc/sysctl.conf | |
echo 'Done!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment