Skip to content

Instantly share code, notes, and snippets.

@skyrocknroll
Last active November 7, 2023 16:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyrocknroll/41e112336ac36901586a505c32f3724b to your computer and use it in GitHub Desktop.
Save skyrocknroll/41e112336ac36901586a505c32f3724b to your computer and use it in GitHub Desktop.
dell fan #temp #fan #ipmi #rx720d #fan #control
#!/usr/bin/env bash
# ----------------------------------------------------------------------------------
# Script for checking the temperature reported by the ambient temperature sensor,
# and if deemed too high send the raw IPMI command to enable dynamic fan control.
#
# Requires:
# ipmitool – apt-get install ipmitool
# slacktee.sh – https://github.com/course-hero/slacktee
# ----------------------------------------------------------------------------------
# IPMI SETTINGS:
# Modify to suit your needs.
# DEFAULT IP: 192.168.0.120
# TEMPERATURE
# Change this to the temperature in celcius you are comfortable with.
# If the temperature goes above the set degrees it will send raw IPMI command to enable dynamic fan control
LOWTEMP=45
HIGHTEMP=55
# This variable sends a IPMI command to get the temperature, and outputs it as two digits.
# Do not edit unless you know what you do.
while true; do
TEMP=$(ipmitool sdr type temperature | grep Temp | grep degrees | grep -Po '\d{2}' | tail -1)
if [[ $TEMP < $LOWTEMP ]]; then
ipmitool raw 0x30 0x30 0x01 0x00
ipmitool raw 0x30 0x30 0x02 0xff 0xa
printf "Warning: Temperature is OK! setting fan control to 10%% ($TEMP C)\n"
elif [[ $TEMP > $HIGHTEMP ]]; then
printf "Warning: Temperature is High! Activating dynamic fan control! ($TEMP C)\n"
ipmitool raw 0x30 0x30 0x01 0x01
else
ipmitool raw 0x30 0x30 0x01 0x00
ipmitool raw 0x30 0x30 0x02 0xff 0x15
printf "Warning: Temperature is OK! setting fan control to 20%% ($TEMP C)\n"
fi
sleep 10
done
~
#!/usr/bin/env bash
# ----------------------------------------------------------------------------------
# Script for checking the temperature reported by the ambient temperature sensor,
# and if deemed too high send the raw IPMI command to enable dynamic fan control.
#
# Requires:
# ipmitool – apt-get install ipmitool
# slacktee.sh – https://github.com/course-hero/slacktee
# ----------------------------------------------------------------------------------
# IPMI SETTINGS:
# Modify to suit your needs.
# DEFAULT IP: 192.168.0.120
# TEMPERATURE
# Change this to the temperature in celcius you are comfortable with.
# If the temperature goes above the set degrees it will send raw IPMI command to enable dynamic fan control
MAXTEMP=40
# This variable sends a IPMI command to get the temperature, and outputs it as two digits.
# Do not edit unless you know what you do.
for VARIABLE in 1 2 3 4 5; do
TEMP=$(ipmitool sdr type temperature | grep Temp | grep degrees | grep -Po '\d{2}' | tail -1)
if [[ $TEMP > $MAXTEMP ]]; then
printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)\n"
ipmitool raw 0x30 0x30 0x01 0x01
else
printf "Temperature is OK ($TEMP C), setting fans to 10%%\n"
ipmitool raw 0x30 0x30 0x01 0x00
ipmitool raw 0x30 0x30 0x02 0xff 0xa
fi
sleep 10
done
@skyrocknroll
Copy link
Author

ipmitool -I lanplus -H 192.168.0.115 -U root -P 'calvin' ipmitool raw 0x30 0x30 0x01 0x01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment