命令记不住

登陆

调整服务器电源性能模式

调整服务器电源性能模式

1.批量脚本

注意重启会失效,建议在带外控制台中设置

#!/bin/bash

cpu0freqd=/sys/devices/system/cpu/cpu0/cpufreq
/sbin/modprobe intel_pstate 2> /dev/null
if [  -d ${cpu0freqd} ]; then
    /usr/bin/cpupower -c all  frequency-set -g  performance > /dev/null 2>&1
else
    /sbin/modprobe -r intel_pstate
    /sbin/modprobe acpi-cpufreq 2> /dev/null
    if [ -d ${cpu0freqd} ]; then
        /usr/bin/cpupower -c all  frequency-set -g  performance > /dev/null 2>&1
    else
        /sbin/modprobe -r acpi-cpufreq 2> /dev/null
    fi
fi

1

2.通过内核修改

重启失效

sed -i 's/^GRUB_CMDLINE_LINUX.*$/GRUB_CMDLINE_LINUX=\"crashkernel=auto rhgb intel_pstate=disable quiet\"/' /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg