Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@SimonHausdorf

This comment has been minimized.

Copy link

@SimonHausdorf SimonHausdorf commented Jul 11, 2017

What if is the server restarts? Do we need to modify the /etc/fstab file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment