All pastes #799800 Raw Edit

Jemand

public text v1 · immutable
#799800 ·published 2007-11-27 21:49 UTC
rendered paste body
#!/bin/bash

modprobe w83627hf

if [ ! -e /sys/devices/platform/w83627hf.656/pwm1 ]; then
  exit 1
fi
  
# Spin the Fan at max for 10s
#echo 255 > /sys/devices/platform/w83627hf.656/pwm1
#sleep 10
  
# Slow the fan to minimum
echo 20 > /sys/devices/platform/w83627hf.656/pwm1
  
LEVEL=20
PWM=20
INCLEVEL=1
  
sleep 60s
while [ true ]; do
  TEMP=`cat /sys/devices/platform/w83627hf.656/temp2_input`
    
  #  echo TEMP=${TEMP} PWM=${PWM} LEVEL=${LEVEL} > /tmp/level
  #  echo TEMP=${TEMP} PWM=${PWM} LEVEL=${LEVEL}
  
  if [ ${TEMP} -ge 80000 ]; then
    /sbin/shutdown -h now
    exit
  else
    if [ ${TEMP} -ge 76000 ]; then
      PWM=255
      INCLEVEL=8
    else
      if [ ${TEMP} -ge 75000 ]; then
        PWM=64
        INCLEVEL=4
      else
        if [ ${TEMP} -ge 60000 ]; then
          PWM=$(((${TEMP} - 45000) / 1000))
          INCLEVEL=1
        else
          if [ ${TEMP} -le 55000 ]; then
            PWM=0
          fi
        fi
      fi
    fi
  fi
  sleep 1
                                                                                                                                                         
  if [ ${PWM} -gt ${LEVEL} ]; then
    LEVEL=$((${LEVEL} + ${INCLEVEL}))
    echo ${LEVEL} > /sys/devices/platform/w83627hf.656/pwm1
  else
    if [ ${PWM} -lt ${LEVEL} ]; then
      LEVEL=$((${LEVEL} - 1))
      echo ${LEVEL} > /sys/devices/platform/w83627hf.656/pwm1
    fi
  fi
                                                                                                                                                                                            
  #echo $TEMP $LEVEL
done