标签:sed bin linu security 修改 file-max sysctl ash mit
#!/bin/bash
fileMax=$(grep "fs.file-max" /etc/sysctl.conf | wc -l)
if [ $fileMax -eq 1 ];then
sed -i ‘/fs.file-max/c\fs.file-max = 70000‘ /etc/sysctl.conf
else
sed -i ‘$a\fs.file-max = 70000‘ /etc/sysctl.conf
fi
nofileMax=$(grep "soft nofile" /etc/security/limits.conf | wc -l)
if [ $nofileMax -eq 1 ];then
sed -i ‘/soft nofile/c\* soft nofile 10000‘ /etc/security/limits.conf
else
sed -i ‘$a\* soft nofile 10000‘ /etc/security/limits.conf
fi
hdfileMax=$(grep "hard nofile" /etc/security/limits.conf | wc -l)
if [ $hdfileMax -eq 1 ];then
sed -i ‘/hard nofile/c\* hard nofile 30000‘ /etc/security/limits.conf
else
sed -i ‘$a\* hard nofile 30000‘ /etc/security/limits.conf
fi
sysctl -p
标签:sed bin linu security 修改 file-max sysctl ash mit
原文地址:http://www.cnblogs.com/ralphdc/p/7060167.html