# !/bin/sh # K.H. Jensen 2008 // www.hartvig.de # Released under the GPL # eeefan version 2 - eee pc fan control utility temperature_reading=/proc/eee/temperature fan_control=/proc/eee/fan_speed fan_manual_switch=/proc/eee/fan_manual # Set critical temperature TEMP_CRITICAL=57 # Set critical temperature interval size. See figure for details TEMP_INTERVAL_SIZE=5 # Maximum fan speed FAN_SPEED_MAX=55 eeefanupdate() { # Get temperature reading TEMP=$(cat $temperature_reading) # Calculate optimum fan speed X=$(echo "$FAN_SPEED_MAX*1/(1+e(-($TEMP-$TEMP_CRITICAL)/$TEMP_INTERVAL_SIZE))" | bc -q -l) # Workaround to convert it to nearest integer FAN_SPEED=$(echo "scale=0; $X/1.0" | bc -q -l) # Set fan speed echo $FAN_SPEED > $fan_control } # cron jobs can only be executed once every minute, # so we have to use the sleep command # Turn on manual fan control echo 1 > $fan_manual_switch # Run eeefanu, then wait 10 seconds. eeefanupdate sleep 10 eeefanupdate sleep 10 eeefanupdate sleep 10 eeefanupdate sleep 10 eeefanupdate