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 | |
SWAP_SIZE_MEGABYTES=$1 | |
if [ $SWAP_SIZE_MEGABYTES -eq 0 ];then | |
echo No swap size given, skipping. | |
else | |
if [ -e /swapfile ];then | |
echo /swapfile already exists, skiping. | |
else | |
echo Creating /swapfile of $SWAP_SIZE_MEGABYTES Megabytes | |
dd if=/dev/zero of=/swapfile bs=1024 count=$(($SWAP_SIZE_MEGABYTES*1024)) |