MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.118.137.96
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0555) :  /usr/bin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/bin/ps_mysqld_helper
#!/bin/bash
if [ -f /etc/redhat-release ]
then
    SYSTEMD_ENV_FILE="/etc/sysconfig/mysql"
else
    SYSTEMD_ENV_FILE="/etc/default/mysql"
fi
enable_thp() {
    STATUS_THP_SYSTEM=0
    if [ -f /sys/kernel/mm/transparent_hugepage/enabled ]; then
        CONTENT_TRANSHP=$(</sys/kernel/mm/transparent_hugepage/enabled)
        STATUS_THP_SYSTEM=$(echo $CONTENT_TRANSHP | grep -cv '\[never\]')
    fi
    if [ $STATUS_THP_SYSTEM = 1 ]
    then
        THP_CONF=$(grep -c "THP_SETTING=never" $SYSTEMD_ENV_FILE)
        if [ $THP_CONF = 1 ]
        then
            if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
                echo never > /sys/kernel/mm/transparent_hugepage/defrag
            fi
            if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
                echo never > /sys/kernel/mm/transparent_hugepage/enabled
            fi
            if [ $? -ne 0 ]; then
                exit 1
            fi
        fi
    fi
}

enable_jemalloc(){
    JEMALLOC_LOCATION=0
    for libjemall in "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do
        if [ -r "${libjemall}/libjemalloc.so.1" ]; then
            JEMALLOC_LOCATION="${libjemall}/libjemalloc.so.1"
            break
        fi
    done
    if [ "x${JEMALLOC_LOCATION}" != "x0" ]; then
        STATUS_JEMALLOC_CONFIG=$(grep -c -e "LD_PRELOAD=.*libjemalloc.so.1" ${SYSTEMD_ENV_FILE})
        if [ $STATUS_JEMALLOC_CONFIG = 0 ]; then
            echo "LD_PRELOAD=${JEMALLOC_LOCATION}" >> ${SYSTEMD_ENV_FILE}
        fi
    fi
}

#main
enable_thp
enable_jemalloc

MMCT - 2023