Skip to content

Instantly share code, notes, and snippets.

@wcypierre
Created June 24, 2020 02:41
Show Gist options
  • Save wcypierre/ca8dd5c58230ee3255a1a2f3cdfacb9b to your computer and use it in GitHub Desktop.
Save wcypierre/ca8dd5c58230ee3255a1a2f3cdfacb9b to your computer and use it in GitHub Desktop.

Revisions

  1. wcypierre created this gist Jun 24, 2020.
    32 changes: 32 additions & 0 deletions dell-ipmi-fan-control.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/bin/bash
    #
    # crontab -l > mycron
    # echo "#" >> mycron
    # echo "# At every 2nd minute" >> mycron
    # echo "*/2 * * * * /bin/bash /scripts/dell_ipmi_fan_control.sh >> /tmp/cron.log" >> mycron
    # crontab mycron
    # rm mycron
    # chmod +x /scripts/dell_ipmi_fan_control.sh
    #
    DATE=$(date +%Y-%m-%d-%H%M%S)
    echo "" && echo "" && echo "" && echo "" && echo ""
    echo "$DATE"
    #
    STATICSPEEDBASE16="0x0f"
    SENSORNAME="Inlet Temp"
    TEMPTHRESHOLD="38"
    #
    T=$(/scratch/ipmitool sdr type temperature | grep $SENSORNAME | cut -d"|" -f5 | cut -d" " -f2)
    echo "$IDRACIP: -- current temperature --"
    echo "$T"
    #
    if [[ $T > $TEMPTHRESHOLD ]]
    then
    echo "--> enable dynamic fan control"
    /scratch/ipmitool raw 0x30 0x30 0x01 0x01
    else
    echo "--> disable dynamic fan control"
    /scratch/ipmitool raw 0x30 0x30 0x01 0x00
    echo "--> set static fan speed"
    /scratch/ipmitool raw 0x30 0x30 0x02 0xff $STATICSPEEDBASE16
    fi