Fan Control
From NAS-Central Buffalo - The Linkstation Wiki
Method 1
http://spock.ss.u-tokai.ac.jp/~kamii/kurobox/hddtemp.shtml
% cat /usr/local/bin/HDDtempChk
#!/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export PATH
REC=/var/spool/rwho/ondorec
LOG=/var/spool/rwho/temp
time=`date '+%y-%m-%d %H:%M'`
data=`hddtemp -nq $1`
ondo=`expr "$data" : '.*: *\([0-9][0-9]*\)[^0-9]*'`
fastspeed()
{
/bin/echo -n ']]]]' > /dev/ttyS1
}
slowspeed()
{
/bin/echo -n '\\\\' > /dev/ttyS1
}
if [ -f $REC ] ; then
count=`cat $REC`
else
echo 0 > $REC
count=-1
fi
if [ $ondo -ge $2 ] ; then
count=`expr $count + 1`
echo $count > $REC
if [ $count -lt 3 ] ; then
ACT=fastspeed
elif [ $count -eq 3 ] ; then
ACT=slowspeed
else
ACT=
fi
else
if [ $count -ne 0 ] ; then
ACT=slowspeed
echo 0 > $REC
else
ACT=
fi
fi
echo "$time $data ($ondo : $2) $ACT" >> $LOG
tail -24 $LOG > ${LOG}x
mv ${LOG}x $LOG
#exit
if [ "$ACT" = "fastspeed" ] ; then
fastspeed
elif [ "$ACT" = "slowspeed" ] ; then
slowspeed
fi
exit
Method 2
http://www.kurobox.info/bbs/index.php?showtopic=550
# Check HD temperature to control the fan speed
#
MAX_TEMP=35
HD_TEMP=`smartctl -A /dev/hda | awk '/^194/ { print($10) }'`
# AVR
#
TTY="/dev/ttyS1"
STR_L="\\\\"
STR_H="]]]]"
# ... check temperature and "silence" the fan
if [ $HD_TEMP -lt $MAX_TEMP ]; then
# tell the AVR Low-speed
echo -n "${STR_L}" > $TTY
else
# tell the AVR High-speed
echo -n "${STR_H}" > $TTY
fi

