echo "" > /proc/sys/vm/overcommit_memory
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
centos_kernel=`uname -r | awk -F "." '{print $1$2}'`
if [ $centos_kernel == ];then
echo "kernel_veriosn:" $centos_kernel
sysctl -w vm.swappiness=
cat /etc/sysctl.conf | grep 'vm.swappiness='
if [ $? == "" ];then
sed -i 's/^vm.swappiness.*//g' /etc/sysctl.conf
echo 'vm.swappiness=0' >> /etc/sysctl.conf
sed -i '/^$/d' /etc/sysctl.conf
else
echo 'vm.swappiness=0' >> /etc/sysctl.conf
fi
elif [ $centos_kernel == ];then
echo "kernel_veriosn:" $centos_kernel
sysctl -w vm.swappiness=
cat /etc/sysctl.conf | grep vm.swappiness=
if [ $? == "" ];then
sed -i 's/^vm.swappiness.*//g' /etc/sysctl.conf
echo 'vm.swappiness=1' >> /etc/sysctl.conf
sed -i '/^$/d' /etc/sysctl.conf
else
echo 'vm.swappiness=1' >> /etc/sysctl.conf
fi
else
echo "kernel_veriosn:" $centos_kernel
exit
fi
over_memory=`cat /proc/sys/vm/overcommit_memory`
echo "overcommit_memory:" $over_memory
defrag=`cat /sys/kernel/mm/transparent_hugepage/defrag`
echo "defrag:" $defrag
cat /etc/sysctl.conf | grep 'vm.swappiness='