So I'm trying to get this working on my server and I'm having a few issues.
#!/bin/bash
# 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=33
TEMP_STEP1=28
TEMP_STEP2=30
TEMP_STEP3=32
IPMIHOST=192.168.1.120
IPMIUSER=myUserName
IPMIPW=myPassword
# 28 -> 20%
# 30 -> 30%
# 32 -> 40%
# 33 -> Automatic control
# 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 -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1)
echo $TEMP
if [ $TEMP -ge $MAXTEMP ]; then
echo " $TEMP is > $MAXTEMP. Switching to automatic fan control "
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01
elif [ $TEMP -le $TEMP_STEP1 ]; then
echo " $TEMP is < $TEMP_STEP1. Switching to manual 20% control "
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x14
elif [ $TEMP -le $TEMP_STEP2 ]; then
echo " $TEMP is < $TEMP_STEP2. Switching to manual 30% control "
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1e
elif [ $TEMP -le $TEMP_STEP3 ]; then
echo " $TEMP is < $TEMP_STEP3. Switching to manual 40% control "
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x28
fi
I've added variables for IP address, username, and pwd.
When I run the script I get the following:
Script location: /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script
Note that closing this window will abort the execution of this script
/tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 20: ipmitool: command not found
/tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 24: [: -ge: unary operator expected
/tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 27: [: -le: unary operator expected
/tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 31: [: -le: unary operator expected
/tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 35: [: -le: unary operator expected
I found this plugin for IMPI and installed it. It says in the post that IPMI Tool is no longer included in the plugin, but when I go to install the package it throws a bunch of errors at me.
Is there something I am missing/not understanding? I'm trying to increase the WAF of my server in our apartment and it's not going too well haha.
EDIT
So I had a brain wave and decided to check NerdTools, and there it was!
Now I get this error:
Script location: /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script
Note that closing this window will abort the execution of this script
27
27 is < 28. Switching to manual 20% control
Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x30 rsp=0xcc): Invalid data field in request
Any suggestions?
EDIT2
Turns out that is a normal message! It works!!
Now for another nooby question: How often do I need to run this?