Advertisement
ZxZ666

swap.sh

Dec 26th, 2013
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if [[ ! -f /swapfile ]]; then
  2.     echo "Building swapfile..."
  3.     sudo dd if=/dev/zero of=/swapfile bs=128M count=$1
  4.     sudo mkswap /swapfile
  5.     sudo swapon /swapfile
  6.    
  7.     # Mount on reboot
  8.     if [[ -z "$(cat /etc/fstab | grep swapfile)" ]]; then
  9.         echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab > /dev/null 2>&1
  10.     fi
  11. fi
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement