Talk:Fannyd - control the temperature and fan of your LinkStation

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search

Feel fee to edit or make comments here...document what you propose to change... thanks!

CODE

/usr/sbin/fannyd #the script for the fan daemon


#! /bin/sh
#
#  fan-temperature control daemon - fannydee
#
#  this script checks the hdd temp on any LS-PPC that is running avr_evtd 
#  and has hddtemp installed.  If the temperature is greater than the 
#  defined limit, it kicks the fan up to high speed.  
#
#  After the checkperiod elapses, it checks again.  If the temperature is
#  below that limit, then it drops it back to low speed.
#
#
#  In /etc/fannyd.conf, mak sure you define your devices that you want to check the temperature on 
#  e.g.  /dev/hda  or /dev/sda , the temperature limit, time check, etc.
#  You can declare more than one hard drive, but that is not a likely situation. 

source /etc/fannyd.conf



	while : ; do
		
		for  A in $DEVICES ; do
			TEMPERATURE=$(/usr/sbin/hddtemp -n $A)
			if [ $TEMPERATURE -gt $TEMPLIMIT ]; then
				echo -n "]]]]" >  $UARTPORT
  			else 
 			        sleep 600     # overcompensate w/ 10 min of extra fan time 
 				echo -n "\\\\" >  $UARTPORT
			fi
		done
		sleep $CHECKPERIOD
	
	done


exit  0


/etc/init.d/fannyd-daemon #startup script

#! /bin/sh
#   
#   start/stop script for fannyd  fan/temperature control daemon
#

case "$1" in
   start)
       echo -n "Starting fannyd"
       /usr/sbin/fannyd & 
       ;;
   stop)
       echo -n "Stopping fannyd"
       killall  fannyd 
       ;;
   restart)
       echo -n "Stopping fannyd"
       killall  fannyd
       echo -n "Starting fannyd"
       /usr/sbin/fannyd &
       ;;
   *)
       echo "Usage: $0 {start|stop|restart}"
       exit 1
       ;;
esac


/etc/fannyd.conf #the configuration file

#  config file for fan-temperature control daemon - fannydee
#
#  The script checks the hdd temp on any LS-PPC that is running avr_evtd 
#  and has hddtemp installed.  If the temperature is greater than the 
#  defined limit, it kicks the fan up to high speed.  
#
#  After the checkperiod elapses, it checks again.  If the temperature is
#  below that limit, then it drops it back to low speed.
#
#
#  Define your devices that you want to check the temperature on 
#  e.g.  /dev/hda  or /dev/sda
#  You can declare more than one, but that is not a likely situation.

DEVICES=/dev/sda

 
# 
#  define the timelimit in seconds.  It is suggested to use a value 
#  around 300 to 600 seconds
#

CHECKPERIOD=600



#
#  define a temperature limit at which you want the fan to kick up at
#  a good value is around 38C.  Yes, use celsius.

TEMPLIMIT=40


#
#  set your UART/AVR serial port that accepts commands here
#  it can be determined by grepping your ps aux output for
#  avr_evtd.  it will be either /dev/ttyS0 or /dev/ttyS1
#  test for avr_evtd running (to be implemented)

UARTPORT=/dev/ttyS0


Hey...

Any chance of getting a look at the code for fannyd? It seems a shame for the utility to be described if no-one except the author can use it! It would seem to do exactly what I need...

Cheers, Mflint 10:41, 7 September 2007 (CEST)


Hi Mflint - sorry, it took me a while to get this up... sorry about the delay... Davy gravy 23:33, 12 October 2007 (CDT)davygravy




Forum topic

There (kind of) is a forum topic concerning this. You may want to post there to get things jump-started. here

Ramuk 11:21, 7 September 2007 (CEST)