Script controla fan
Link: https://forum.proxmox.com/threads/ipmi-tool-error-after-v8-upgrade.129334/page-2
Bash:
#!/bin/bash
# Fancontrol v1.1 2022-09-15 15:42
# Define variables
MAX_FAN=90
MIN_FAN=20
HIGH_TEMP=37
LOW_TEMP=35
SPEED_STEP=10
IDRAC_IP=10.0.0.1
IPMI_USER=fancontrol
IPMI_PASSWORD=yoursupercomplexpassword
# Define Functions
ENABLE_FAN ()
{
ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x01 0x00 > /dev/null 2>&1
}
GET_TEMP ()
{
ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD sensor reading "Exhaust Temp"|sed 's/[^0-9]//g'
}
SET_FAN ()
{
ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x02 0xff $FAN_SETTING > /dev/null 2>&1
}
# File to save the last fan speed
[ -f fan_speed.last ] || echo $MIN_FAN > fan_speed.last
FAN_SPEED=$(<fan_speed.last)
#-----------------------------------------------------------------------------------------
CURRENT_TEMP=$(GET_TEMP) # get the current temperature
if (($CURRENT_TEMP > $HIGH_TEMP)) ; then
FAN_SPEED=$(expr $FAN_SPEED + $SPEED_STEP)
if (($FAN_SPEED > $MAX_FAN)) ; then
FAN_SPEED=$MAX_FAN
fi
fi
if (($CURRENT_TEMP < $LOW_TEMP)) ; then
FAN_SPEED=$(expr $FAN_SPEED - $SPEED_STEP)
if (($FAN_SPEED < $MIN_FAN)) ; then
FAN_SPEED=$MIN_FAN
fi
fi
FAN_SETTING=$(printf "0x"'%x\n' $FAN_SPEED)
ENABLE_FAN
SET_FAN
logger -t FanControl "Current Temperature" $CURRENT_TEMP"C" "Fans at" $FAN_SPEED"%"
echo $FAN_SPEED > fan_speed.last
exit 0