From fec5231de4b1b09d4ce3bec8d25078c26fd9b9cc Mon Sep 17 00:00:00 2001 From: xiaoz Date: Tue, 22 Dec 2020 16:35:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=99=9A=E6=8B=9F=E5=86=85?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- set_swap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/set_swap.sh b/set_swap.sh index a4d0cb4..3b55c7c 100644 --- a/set_swap.sh +++ b/set_swap.sh @@ -16,7 +16,7 @@ get_swap=`free -mt|grep 'Swap'|awk '{print $2}'` #内存如果小于2g,则设置2倍 if [ $p_mem -lt 2000 ] then - swap_value=$p_mem*2 + swap_value=`$p_mem*2` elif [ $p_mem -gt 2000 ] && [ $p_mem -lt 8000 ] #内存大于2G,小于8G,则设置和物理内存大小一致 then @@ -31,6 +31,7 @@ fi function set_swap(){ #创建swap dd if=/dev/zero of=/dev/swap bs=1M count=${swap_value} + chmod 600 /dev/swap mkswap /dev/swap swapon /dev/swap #写入分区表