File: //opt/BCLinux/bse/secure_set/s22_resourceLimit
#!/bin/sh
##=====================================================================
InsertSection "Set the coredump"
if [ $SET_CORE_DUMP -eq 1 ]; then
cp -np /etc/security/limits.conf /etc/security/limits.conf_bak
IS_EXIST=`egrep -v '^$|^#' /etc/security/limits.conf | grep soft | grep core | wc -l`
if [ ${IS_EXIST} -ge 1 ] ; then
sed -i 's/soft core.*/soft core 0/' /etc/security/limits.conf
else
echo " " >> /etc/security/limits.conf
echo "* soft core 0" >> /etc/security/limits.conf
fi
IS_EXIST=`egrep -v '^$|^#' /etc/security/limits.conf | grep hard | grep core | wc -l`
if [ ${IS_EXIST} -ge 1 ] ; then
sed -i 's/hard core.*/hard core 0/' /etc/security/limits.conf
else
echo " " >> /etc/security/limits.conf
echo "* hard core 0" >> /etc/security/limits.conf
fi
Display --indent 2 --text "- Setting the soft/hard core limit... " --result FINISHED --color GREEN
else
Display --indent 2 --text "- Skip set coredump due to config file... " --result SKIPPING --color YELLOW
fi