Jump to content
sibi78

IPMI Temperature Script and Crontab in Unraid

5 posts in this topic Last Reply

Recommended Posts

Hi All,

 

I have a Dell R710, and I found this script (https://github.com/NoLooseEnds/Scripts/blob/master/R710-IPMI-TEMP/R710-IPMITemp.sh) online to automatically control fan speed via IPMI. I was trying to set this up on my server with a custom script. I had a couple of questions regarding this:

 

1) I originally created my own shell script based off the above example in /root of my UNRAID server. The script was working well, but I had to stop the array, and restart the server. When the system rebooted, I noticed that my script stored in the path /root was deleted. This was surprising to me as I had expected the root filesystem to be persistent. Is this not true? If it is, where is a recommended place to store this script?

 

2) I had manually created a crontab entry for the root user to the run the above script periodically. That crontab entry also didn't persist across reboots. I was wondering what's the recommended way (plugin) for doing the crontab entry?

 

Thanks for your help!

Share this post


Link to post
5 minutes ago, sibi78 said:

This was surprising to me as I had expected the root filesystem to be persistent. Is this not true? If it is, where is a recommended place to store this script?

Anything not stored in /mnt/diskX (or /mnt/user/) or /boot is not persistent.

 

5 minutes ago, sibi78 said:

I was wondering what's the recommended way (plugin) for doing the crontab entry?

User scripts plugin would be the easiest method

 

Alternatives would be entering the commands in via the "go" file.

Share this post


Link to post

@Squid, thanks for the reply, and for the "user scripts" plugin - it's very useful. I've created the same script via the user scripts plugin, and everything works well. I'm looking for a way to capture the output of my script to a log file (preferably in the plugin folder or in /tmp/) to check if everything is running properly. I couldn't find a way when I searched the forum. Could you shed some light into how I'd do this? Thanks!

Share this post


Link to post

@sibi78 I am trying to do the same, yet I did not get it to as expected. I hope it is ok to ask to see your script.

 

/Alphahelix

Share this post


Link to post
Posted (edited)

@Alphahelix, sure. With due credit to the original link (https://github.com/NoLooseEnds/Scripts/blob/master/R710-IPMI-TEMP/R710-IPMITemp.sh ), I made some slight tweaks. Note I can confirm this is working on my dell poweredge R710, your mileage might vary depending on the type of server. It's nothing fancy, but I'm starting out simple to see how it works - I mainly wanted to reduce the fan speeds from ~6K RPM with automatic fan control to something less noisy.

 

The IPMI* variables must be filled with the right values for your server. Hope this helps.

 

# 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

# 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
 

Edited by sibi78

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.