Last active
October 23, 2023 08:37
-
-
Save perry-mitchell/ebc3bf974a3038f97efe74cd50b2c6a3 to your computer and use it in GitHub Desktop.
Dell R720 quiet fan control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IDRAC_IP="192.168.0.101" | |
IDRAC_USER="root" | |
IDRAC_PASS=$1 | |
if [ -z $IDRAC_PASS ]; then | |
IDRAC_PASS=$IDRAC_PASSWORD | |
fi | |
FANS_1="0x0A" # 10% | |
FANS_2="0x0F" # 15% | |
FANS_3="0x14" # 20% | |
FANS_4="0x19" # 25% | |
# FANS_5="0x23" # 35% | |
restore_dynamic_control() { | |
echo "Restoring dynamic fan control" | |
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASS raw 0x30 0x30 0x01 0x01 | |
} | |
set_speed() { | |
if [ -z $1 ]; then | |
echo "No speed set" | |
exit 2 | |
fi | |
echo "Set speed: $1" | |
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASS raw 0x30 0x30 0x02 0xff $1 | |
} | |
on_error() { | |
restore_dynamic_control | |
} | |
trap "on_error" ERR | |
TEMP=$(ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASS sdr type temperature | egrep "^Temp" | cut -d"|" -f5 | cut -d" " -f2 | sort -n -r | head -1) | |
echo "Highest Temp: $TEMP C" | |
case $TEMP in | |
[0-9]) | |
set_speed $FANS_1 | |
;; | |
[1-2][0-9]) | |
set_speed $FANS_1 | |
;; | |
3[0-9]) | |
set_speed $FANS_1 | |
;; | |
4[0-5]) | |
set_speed $FANS_2 | |
;; | |
4[6-9]) | |
set_speed $FANS_3 | |
;; | |
5[0-4]) | |
set_speed $FANS_4 | |
;; | |
*) | |
restore_dynamic_control | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment