Skip to content

Instantly share code, notes, and snippets.

@emcniece
Created June 10, 2025 01:58
Show Gist options
  • Save emcniece/1ca265802024f7fbeca0c8bfcaa59688 to your computer and use it in GitHub Desktop.
Save emcniece/1ca265802024f7fbeca0c8bfcaa59688 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Custom IPMI Fan control script for speed overrides to prevent premature hurricanes
# Run this every 30s or 60s in Cron
# Tested on Dell R730 and HP DL380P gen8
# Read the max CPU temp from sensors (lm-sensor)
tempCpu=$(sensors|grep "high"|cut -d "+" -f2|cut -d "." -f1|sort -nr|sed -n 1p)
# Define CPU limit
# Set access vars
host=$(ipmitool mc getsysinfo delloem_url | awk -F[/:] '{print $4}')
user="ipmi_user"
password="ipmi_password"
echo "Accessing IPMI at host ${host} with user ${user}"
# Define low/med/high temp
minCpu="50"
medCpu="56"
maxCpu="61"
if [ $tempCpu -le $minCpu ] ; then
# Set to 3200 RPM
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x01 0x00 >> /dev/null
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x02 0xff 0x13 >> /dev/null
elif [ $tempCpu -le $medCpu ] ; then
# Set to 3600 RPM
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x01 0x00 >> /dev/null
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x02 0xff 0x17 >> /dev/null
elif [ $tempCpu -le $maxCpu ] ; then
# Set to 5000 RPM
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x01 0x00 >> /dev/null
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x02 0xff 0x20 >> /dev/null
else
# Let the server decide beyond max temp
ipmitool -I lanplus -H $host -U $user -P $password raw 0x30 0x30 0x01 0x01 >> /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment