[edit 14/6/2017]
- script force_fanspeed.sh : fixed fan speed and limited time execution. script is here in 1st reply
- script smart_fanspeed.sh : using disks temp sensor to smooth discs temperature by actively acting on the fan speed., script is here
- startup script for smart_fanspeed.sh : in order to start script at boot. see here.
In order to launch and install these scripts, you must be connected to your NAS with ssh, and with root user.
Here is a little script I wrote in response of FAN control on AS6204T
- This script is successfully tested on AS5002T and AS3102T. I cannot guarantee that it will works on other models, specially if they are using more that one fan.
- script is intended for people who knows about using ssh terminal on their NAS.
- Copy paste the script on the NAS, on location of your choice, in a file named force_fanspeed.sh, and make it executable ( chmod +x )
- script syntax is
..../force_fanspeed.sh SPEED DURATION
SPEED : from 30 to 255, 75-80 are optimal : less noisy than "medium", but cooling enough, far more than "auto".
DURATION : in minutes.
script is intended to use has less resources has possible on your NAS. the basic command ( fanctrl -set fanpwm ) works only for 10 seconds, some other process is working here and reverts fan speed every 10 seconds to settings stored in ADM.
That's why this script first make a pause of 9 seconds, and then actively scan when fan speed setting is changed to reinstall it's own setting just 1/10 second after.
script needs about 1mn to really override default fan speed. Don't worry if fan speed reverts temporarily to default settings during the first minute.
once script is breaked or ended, fan speed reverts to default setting stored in ADM.
sample invocation : crontab line, increase fan speed nights, during backup ( ADM setting is "auto" ) :
Code: Select all
00 23 * * * /bin/sh /share/Syst_interne/force_fanspeed.sh 75 480
script content :
Code: Select all
#!/bin/sh
mysynerror() {
echo $0 SPEED DURATION
echo with SPEED from 30 to 255
echo duration in minutes
echo script needs about 1mn to really override fanspeed
exit 6
}
if [ "$2" = "" ]
then
mysynerror
fi
DESIREDPOWER="$1"
DURATION="$2"
FANID=0
##DESIREDPOWER=75 # from about 30 to 255
if [ \( "$DESIREDPOWER" -lt 30 \) -o \( "$DESIREDPOWER" -gt 255 \) ]
then
mysynerror
fi
if [ "$DURATION" -le 0 ]
then
mysynerror
fi
COUNTDWN=`expr $DURATION \* 6`
while [ $COUNTDWN -gt 0 ]
do
CURRPOWER=`fanctrl -getfanspeed|awk ' { print $NF } ' `
if [ $DESIREDPOWER -ne $CURRPOWER ]
then
fanctrl -setfanpwm $FANID $DESIREDPOWER
## echo $CURRPOWER to $DESIREDPOWER CPT : $CPT
CPT=0
COUNTDWN=`expr $COUNTDWN - 1`
sleep 9
else
sleep 0.1
CPT=`expr $CPT + 1`
fi
done