Last active
September 27, 2019 10:54
-
-
Save rickyhewitt/0e98bcad02fc44df17be to your computer and use it in GitHub Desktop.
Revisions
-
rickyhewitt revised this gist
Mar 24, 2019 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,15 @@ # createswap.sh # creates swap file. # Optionally specify size (e.g. 1024M) # If no size is specified, default to physical memory / 4 # # <[email protected]> if [ $1 ]; then SWAP_SIZE=$1 else PHYSICAL_MEM=$(head /proc/meminfo | awk 'BEGIN {OFS = FS} NR==1{print $2}') SWAP_SIZE=$(($PHYSICAL_MEM/4)) fi echo "Creating swap file with size of $SWAP_SIZE" @@ -19,5 +20,5 @@ mkswap /swap chmod 600 /swap swapon /swap sed -i -e '$a/swap none swap sw 0 0' /etc/fstab sysctl vm.swappiness=15 sed -i -e '$avm.swappiness=15' /etc/sysctl.conf -
rickyhewitt revised this gist
Sep 18, 2016 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,15 +5,16 @@ # # <[email protected]> if [ $1 ]; then SWAP_SIZE=$1 else echo "No swap size specified." exit 1; # fail fi echo "Creating swap file with size of $SWAP_SIZE" fallocate -l $SWAP_SIZE /swap mkswap /swap chmod 600 /swap swapon /swap -
rickyhewitt created this gist
Feb 18, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/bin/sh # createswap.sh # creates swap file. # Optionally specify size (e.g. 1024M) # # <[email protected]> SWAP_SIZE="512M" if [ $1 ]; then SWAP_SIZE=$1 fi echo "Creating swap file with size of $SWAP_SIZE" dd if=/dev/zero of=/swap bs=$SWAP_SIZE count=1 mkswap /swap chmod 600 /swap swapon /swap sed -i -e '$a/swap none swap sw 0 0' /etc/fstab sysctl vm.swappiness=10 sed -i -e '$avm.swappiness=10' /etc/sysctl.conf