swapkvm.sh 526 B

12345678910111213141516
  1. #!/bin/bash
  2. dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
  3. dd if=/dev/zero of=/swapfile2 bs=1024 count=524288
  4. mkswap /swapfile1
  5. mkswap /swapfile2
  6. chown root:root /swapfile1
  7. chown root:root /swapfile2
  8. chmod 0600 /swapfile1
  9. chmod 0600 /swapfile2
  10. swapon /swapfile1
  11. swapon /swapfile2
  12. sed -i '$ i\swapon /swapfile1' /etc/rc.local
  13. sed -i '$ i\swapon /swapfile2' /etc/rc.local
  14. sed -i '$ i\/swapfile1 swap swap defaults 0 0' /etc/fstab
  15. sed -i '$ i\/swapfile2 swap swap defaults 0 0' /etc/fstab
  16. rm -f swapkvm.sh