Advertisement
jbthechamp

Make Swap on Debian/Ubuntu

Nov 27th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Swap File Creator
  4. #
  5. # This script will create and configure a swap file
  6. # on your droplet at creation time.
  7.  
  8. # Swap file size
  9. # example swapsize="1G"
  10. swapsize="<%SWAP_FILE_SIZE%>"
  11. fallocate -l $swapsize /swapfile;
  12. chmod 600 /swapfile;
  13. mkswap /swapfile;
  14. swapon /swapfile;
  15.  echo "/swapfile   none    swap    sw    0   0" >> /etc/fstab;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement