Created
March 15, 2016 02:01
-
-
Save steinnes/3a1de7250de10687ade1 to your computer and use it in GitHub Desktop.
swapfile setup script
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 | |
SWAPFILE=/var/swapfile | |
SWAP_MEGABYTES=2048 | |
if [ -f $SWAPFILE ]; then | |
echo "Swapfile $SWAPFILE found, assuming already setup" | |
exit; | |
fi | |
/bin/dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES | |
/bin/chmod 600 $SWAPFILE | |
/sbin/mkswap $SWAPFILE | |
/sbin/swapon $SWAPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What if is the server restarts? Do we need to modify the
/etc/fstab
file?