Trying to update an Dell R210 II

It just never ends… -.-

Udklip

Got it to connect locally, and threw together a bash script to manually set fan speed.

#!/bin/bash

echo "Fan control started"

for i in `seq 1 11`;
do
	temp=`sensors | grep "CPU Temp" | sed 's/.*:\s*+\(.*\)  .*(.*/\1/'`
	temp=${temp::-4}
	
	echo "CPU Temp: $temp" 
	
	temp_min=40
	temp_max=95
	
	fan_min=10
	fan_max=64
	
	fan_speed=$((($temp-$temp_min)*($fan_max-$fan_min)/($temp_max-$temp_min)+$fan_min))
	
	if [ $fan_speed -lt $fan_min ]; then
		fan_speed=$fan_min
	elif [ $fan_speed -gt $fan_max ]; then
		fan_speed=$fan_max
	fi
		
	cmd="0x30 0x30 0x02 0xff 0x$fan_speed"
	echo "Command: $cmd"

	# Enable manual control
	ipmitool raw 0x30 0x30 0x01 0x00
	# Set fan speed
	ipmitool raw $cmd

	if [ $i -le 10 ]; then
		sleep 5
	fi
done

This can be started with a cronjob to run every minute, and it will then check the temperature every 5th second and calculate the fan speed.

Fan speed is calculated from minimum and maximum temperature, where there is an lower and upper limit to how fast they can be set. (fan range is 0-64)

Well look at that! Gotta love some hacking! :+1:

Congrats on getting everything sorted, albeit a lil side-door style! Makes it more interesting thought, right? Plus you can tell Murphy to fly a kite. :stuck_out_tongue:

I got annoyed of the fans changing speed at the smallest temperature change, so I added some averaging, so as long as the speed change difference is less than 15, averaging will be used. If the change is bigger than 15, it will just jump directly to it.

The values I have put in seems to be pretty decent, going from idle to full load makes the temperature start rising slowly, and the fans slowly spin up. But after 30-40 seconds the temperature really starts going up, and then the fans jump up to a higher setting, and averaging again takes over and keeps them steady there.

Doing the averaging and such would have been so much easier in python, but I wanted it done in bash to get it as “raw” as possible.

#!/bin/bash

temp_min=50
temp_max=95

fan_min=10
fan_max=64

# Percentage of the old reading which will be used to calculate the new fan speed
force=75

# Seconds between each reading
delay=3

# Average only when difference is less than
avg_skip=15

echo "Fan control started"

fan_speed_old=64

if [ -f "/tmp/last_speed" ]; then
    fan_speed_old=$(sed -n '1p' < "/tmp/last_speed")
	echo "Last speed was $fan_speed_old"
fi

# Enable manual control
ipmitool raw 0x30 0x30 0x01 0x00 > /dev/null 2>&1

while true; do
	temp=`sensors | grep "CPU Temp" | sed 's/.*:\s*+\(.*\)  .*(.*/\1/'`
	temp=${temp::-4}
	
	echo "CPU Temp: $temp" 
	
	fan_speed=$((($temp-$temp_min)*($fan_max-$fan_min)/($temp_max-$temp_min)+$fan_min))
	
	res=$(echo "$fan_speed-$fan_speed_old" | bc)
	
	if [[ "$res" -lt 0 ]] ; then
		res=$(echo `expr 0 - $res`)
	fi
	
	if [[ $res -lt $avg_skip ]]; then
		echo " Averaging:"
		cforce=$(echo "scale=2;$force/100" | bc)
		old=$(echo "scale=2;$fan_speed_old*$cforce" | bc -l)
		echo -e "  Old speed $old"
		
		cforce=$(echo "scale=2;1-$cforce" | bc)
		new=$(echo "scale=2;$fan_speed*$cforce" | bc -l)
		echo -e "  New speed $new"
		
		fan_speed=$(echo "scale=0;$old+$new" | bc)
		fan_speed=$(echo "($fan_speed+0.5)/1" | bc )
		echo -e "  Fan speed: $fan_speed"
	fi
	
	fan_speed_old=$fan_speed
	
	if [[ $fan_speed -lt $fan_min ]]; then
		fan_speed=$fan_min
	elif [[ $fan_speed -gt $fan_max ]]; then
		fan_speed=$fan_max
	fi
	
	cmd="0x30 0x30 0x02 0xff 0x$fan_speed"
	echo "Command: $cmd"

	# Set fan speed
	ipmitool raw $cmd > /dev/null 2>&1
	
	current=$(date +"%S")
	current=$(echo $current | sed 's/^0*//')
	if [[ $current -gt 51 ]]; then
		echo $fan_speed_old > /tmp/last_speed
		sleep 1
		exit
	fi
	
	echo -e ""
	
	sleep $delay
done