Skip to content

Instantly share code, notes, and snippets.

@qlyoung
Created December 21, 2019 01:41
Show Gist options
  • Save qlyoung/44282a8283879d967b0c4314e7d4fb82 to your computer and use it in GitHub Desktop.
Save qlyoung/44282a8283879d967b0c4314e7d4fb82 to your computer and use it in GitHub Desktop.
set R710 fans to either manual 15% or automatic based on ipmi temperature
#!/bin/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=35
# 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.
TEMP=$(ipmitool sdr type temperature |grep Ambient |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 15%%\n"
ipmitool raw 0x30 0x30 0x01 0x00
ipmitool raw 0x30 0x30 0x02 0xff 0x09
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment