Created
February 13, 2012 14:54
-
-
Save kimlindholm/1817411 to your computer and use it in GitHub Desktop.
Create swapfile if not already present
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 | |
# Create swapfile if not already present. Default size is 2 GB. | |
if [ ${SWAP_SIZE_MEGABYTES:=2048} -eq 0 ];then | |
echo No swap size given, skipping. | |
else | |
if [ -e /swapfile ];then | |
echo /swapfile already exists, skipping. | |
else | |
echo Creating /swapfile of $SWAP_SIZE_MEGABYTES MB | |
dd if=/dev/zero of=/swapfile bs=1024 count=$(($SWAP_SIZE_MEGABYTES*1024)) | |
mkswap /swapfile | |
fi | |
swapon /swapfile | |
echo Swap Status: | |
swapon -s | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From presentation Improving Site Response Time, Part 3 - Varnish Configuration Step by Step