use-swap-aliyun.bash 436 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. set -x
  3. free
  4. mkdir /data -p
  5. dd if=/dev/zero of=/data/swap bs=512 count=8388616
  6. df
  7. mkswap /data/swap
  8. cat /proc/sys/vm//swappiness
  9. sysctl -a | grep swappiness
  10. sysctl -w vm.swappiness=60
  11. sysctl -a | grep swappiness
  12. cat /etc/sysctl.conf | grep swap
  13. cp /etc/sysctl.conf ~/sysctl.conf
  14. sed -i 's/vm.swappiness = 0/vm.swappiness = 60/' /etc/sysctl.conf
  15. diff /etc/sysctl.conf ~/sysctl.conf
  16. swapon /data/swap
  17. df
  18. free