Created
August 4, 2019 22:14
-
-
Save d6e/c5185df874b3ea17e3ec6507ac26bde2 to your computer and use it in GitHub Desktop.
Creates a temporary swap file
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 | |
SWAPFILENAME=swapfile1 | |
SWAPPATH="/$SWAPFILENAME" | |
if [ ! -f "$SWAPPATH" ]; then | |
dd if=/dev/zero of="$SWAPPATH" bs=1024 count=1048576 | |
chown root:root "$SWAPPATH" | |
chmod 0600 "$SWAPPATH" | |
mkswap "$SWAPPATH" | |
fi | |
swapon "$SWAPPATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment