HEX
Server: nginx/1.16.1
System: Linux ecs-04358622 4.19.90-2107.6.0.0100.oe1.bclinux.x86_64 #1 SMP Wed Dec 1 19:59:44 CST 2021 x86_64
User: nginx (994)
PHP: 8.0.0
Disabled: NONE
Upload Files
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