Hi,
on my NAS i can controll the fans by simple bash-commands, so I set up a bash-script which controlls the fan by CPU-Temperature and the active/idle-state of the Harddrives.
It's a simple solution:
Bash
#!/bin/bash
HDDS="/dev/sda /dev/sdb /dev/sdd /dev/sde"
HDT=hddtemp
LOG=
DOWN=
ALERT_LEVEL=50
args="--numeric"
VALUE_SIDE=0
VALUE_BACK=0
#while true
#do
#sleep 1
CPU=0
VALUE_SIDE=0
VALUE_BACK=0
I=0
for disk in $HDDS
do
HDTEMP=$(hdparm -C $disk)
if [[ $HDTEMP != *standby* ]]; then
VALUE_SIDE=$(($VALUE_SIDE + 255))
VALUE_BACK=150
I=$(($I + 1))
fi
done
CPU1=$(cat /sys/class/hwmon/hwmon1/device/temp2_input)
CPU2=$(cat /sys/class/hwmon/hwmon1/device/temp3_input)
CPU3=$(cat /sys/class/hwmon/hwmon1/device/temp4_input)
CPU4=$(cat /sys/class/hwmon/hwmon1/device/temp5_input)
CPU=$(($CPU1 + $CPU2 + $CPU3 + $CPU4))
CPU=$(($CPU / 4000))
if [ $CPU -ge 40 2>&- ]; then
VALUE_BACK=120
fi
if [ $CPU -ge 45 2>&- ]; then
VALUE_BACK=150
fi
if [ $HDTEMP -ge 55 2>&- ]; then
VALUE_BACK=255
fi
if [ $I -ge 1 2>&- ]; then
VALUE_SIDE=$(($VALUE_SIDE / $I))
fi
echo $VALUE_SIDE
echo $VALUE_BACK
echo 1 > /sys/class/hwmon/hwmon2/device/pwm1_enable
echo 1 > /sys/class/hwmon/hwmon2/device/pwm2_enable
echo $VALUE_SIDE > /sys/class/hwmon/hwmon2/device/pwm1
echo $VALUE_BACK > /sys/class/hwmon/hwmon2/device/pwm2
#done
Alles anzeigen
You need to install and set up hdparm and hwmon to use it.
It's very simple - but it does what it should.
-> When one HDD is active it starts the fans in the side of the case
-> it starts the fan in the back of the case when the cpu reaches different temperature levels.
You can exceute this script in an endless-loop by removing the # in the script. I've set up a cron-job which runs it every minute.