林敬 6 years ago
parent
commit
eca7d9abdb
1 changed files with 23 additions and 0 deletions
  1. 23 0
      use-swap-aliyun.bash

+ 23 - 0
use-swap-aliyun.bash

@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -x
+
+free
+mkdir  /data -p
+dd if=/dev/zero of=/data/swap bs=512 count=8388616
+df
+mkswap /data/swap
+
+cat /proc/sys/vm//swappiness  
+sysctl -a | grep swappiness
+sysctl -w vm.swappiness=60
+sysctl -a | grep swappiness
+
+cat /etc/sysctl.conf  | grep swap
+cp /etc/sysctl.conf  ~/sysctl.conf
+sed -i 's/vm.swappiness = 0/vm.swappiness = 60/' /etc/sysctl.conf  
+diff /etc/sysctl.conf  ~/sysctl.conf  
+
+swapon  /data/swap
+df 
+free