oneliners/almost_oneliners/ipmi-limit-fans.sh

57 lines
1.6 KiB
Bash
Raw Normal View History

2024-11-23 19:50:12 +01:00
#!/bin/bash
# This script limits the threshholds of the superloud supermicro fans to more
# manageable values, if used as is (instead of swapping fans for e.g. noctua fans).
# Put this in e.G. /etc/init.d/ , because values are reverted on powerloss.
# set limits in 64 steps from 00-FF (convert to hex!):
# 0x00 == 0% / minimal
# ...
# 0x16 == 25%
# 0x24 == 37.5%
# 0x32 == 50%
# ...
# 0x64 == 100% / fullspeed
LIMIT="0x16"
# number of fans installable on given mainboard (check with e.G. `ipmitool sdr | grep -i rpm`)
FANCOUNT="8"
# fan critical limits
LNR="300" # Lower Non-Recoverable
LC="500" # Lower Critical
LNC="700" # Lower Non-Critical
UNC="10000" # Upper Non-Critical
UC="10500" # Upper Critical
UNR="11000" # Upper Non-Recoverable
# check availability of ipmitool
if
which ipmitool >/dev/null
then
echo "ipmitool available. Continue."
else
echo "ipmitool not installed. Aborting."
exit 1
fi
# limit upper and lower values for fans 1-8 to non-unrealistic values
for fan in $(seq 1 $FANCOUNT); do
/usr/bin/ipmitool sensor thresh FAN$fan upper $UNC $UC $UNR
/usr/bin/ipmitool sensor thresh FAN$fan lower $LNR $LC $LNC
done
echo "set fan mode to full (needed for static control) and let things settle"
/usr/bin/ipmitool raw 0x30 0x45 0x01 0x01; sleep 10
echo "set fans in "system" zone to 25% and let things settle"
/usr/bin/ipmitool raw 0x30 0x70 0x66 0x01 0x00 $LIMIT; sleep 5
echo "set fans in "peripheral" zone to 25% and let things settle"
/usr/bin/ipmitool raw 0x30 0x70 0x66 0x01 0x01 $LIMIT; sleep 5
echo "all done"