Advertisement
Guest User

Fan Speed Control on r710

a guest
Jan 17th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.65 KB | None | 0 0
  1. #!/bin/bash
  2. # ----------------------------------------------------------------------------------
  3. # Script for checking the temperature reported by the ambient temperature sensor,
  4. # and if deemed too high send the raw IPMI command to enable dynamic fan control.
  5. # ----------------------------------------------------------------------------------
  6.  
  7.  
  8. # IPMI SETTINGS:
  9. # Modify to suit your needs.
  10. # DEFAULT IP: 192.168.0.120
  11. IPMIHOST=192.168.1.xxx
  12. IPMIUSER=
  13. IPMIPW=
  14. echo $(date) "Checking Tempature Values"
  15.  
  16. ipmitool -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -I lanplus sensor reading "FAN 1 RPM" "Ambient Temp"
  17.  
  18. # TEMPERATURE
  19. # Change this to the temperature in celcius you are comfortable with.
  20. # If the temperature goes above the set degrees it will send raw IPMI command to enable dynamic fan control
  21.  
  22. MAXTEMP=30
  23. MIDTEMP=25
  24. LOWSPEED=2280
  25. MIDSPEED=4440
  26.  
  27. # This variable sends a IPMI command to get the temperature, and outputs it as two digits.
  28. # Do not edit unless you know what you do.
  29. TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1)
  30. FANSPEED=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW  sensor reading "FAN 1 RPM" |grep FAN |grep -Po '\d{4}' | tail -1)
  31.  
  32. echo $(date) "Current Fan Speed" $FANSPEED
  33. echo $(date) "Current Ambient Temp" $TEMP
  34.  
  35.  
  36. if [[ $TEMP > $MAXTEMP ]];
  37.   then
  38.     # printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)" | systemd-cat -t R710-IPMI-TEMP
  39.     echo $(date) "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)"
  40.  
  41.     ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01
  42.  
  43.   elif [[ $TEMP > $MIDTEMP ]]; then
  44.     if [[ $FANSPEED -eq $MIDSPEED ]]; then
  45.        echo "skiping"
  46.     else
  47.        echo $(date) "Temperature is OK little Warm " $TEMP "c"
  48.        echo $(date) "Setting Syttem to Manual fan control"
  49.        ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
  50.        echo $(date) "Boosting Fan Speed"
  51.        echo $(date) "Setting Fans to 4440rpm"
  52.        ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1e
  53.     fi
  54. else
  55.     if [[ $FANSPEED -le $LOWSPEED ]]; then
  56.        echo $(date) "Fan at Speed and Temp Skiping"
  57.     else
  58.        echo $(date) "Setting System To Manual Fan Control"
  59.        ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
  60.        echo $(date) "Temperature is OK ($TEMP C)"
  61.        echo $(date) "Setting Fans to 2280rpm"
  62.        ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x0a
  63.    fi
  64. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement