swapfile setup script
#!/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
This comment has been minimized.
What if is the server restarts? Do we need to modify the
/etc/fstab
file?