Advertisement
ZxZ666

swap.sh

Dec 26th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement