-
-
Save q7r/136ca7dbbb5f98e17e38 to your computer and use it in GitHub Desktop.
A simple little shell script that executes the digital ocean swap file tutorial.
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
#/bin/sh | |
if [ -f /swapfile ]; then | |
echo "Swap file already exists." | |
else | |
dd if=/dev/zero of=/swapfile bs=1024k count=2000 | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
sysctl -w vm.swappiness=20 | |
echo "vm.swappiness=20" >> /etc/sysctl.conf | |
free | |
echo "Swap created and added to /etc/fstab for boot up." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment