#修改进程可以打开的最大文件描述符数
#----------------------------------------------------------------------
if ! grep /etc/security/limits.conf -rne '^[^#].*nofile'; then
echo '111'
sudo sed /etc/security/limits.conf -e '/End of file/i\
* soft nofile 65535\
* hard nofile 65535\
root soft nofile 65535\
root hard nofile 65535' -i
fi
#----------------------------------------------------------------------
#开启core dump
#----------------------------------------------------------------------
if ! grep /etc/security/limits.conf -rne '^[^#].*core'; then
echo '222'
sudo sed /etc/security/limits.conf -e '/End of file/i\
* soft core unlimited\
* hard core unlimited\
root soft core unlimited\
root hard core unlimited' -i
fi
#----------------------------------------------------------------------
#设置core dump文件格式:
#----------------------------------------------------------------------
if ! grep /etc/rc.local -rne core_pattern; then
echo '333'
echo "exit 0" >> /etc/rc.local
sudo sed /etc/rc.local -e'/^exit 0/iecho 1 > /proc/sys/kernel/core_uses_pid\necho core-%e-%p-%t > /proc/sys/kernel/core_pattern' -i
fi
#----------------------------------------------------------------------