Created
August 15, 2014 19:57
-
-
Save PEKTOP/ac51839fbabe55e51620 to your computer and use it in GitHub Desktop.
Create SWAP 1Gb
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/bash | |
if [ ! -f /swapfile ]; then | |
sudo fallocate -l 1G /swapfile | |
echo -e "\e[32mSWAP file created.\e[39m" | |
else | |
echo -e "\e[33mSWAP file already exist.\e[39m" | |
fi | |
if ! [[ `swapon -s | grep /swapfile` ]]; then | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo -e "\e[32mSWAP created and enabled!\e[39m" | |
else | |
echo -e "\e[31mSWAP already enabled!\e[39m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment