Post
Topic
Board Mining software (miners)
Re: Any linux script for maintain GPU temp? (changing fan speed)
by
swivel
on 08/07/2011, 23:32:30 UTC
Here's a simple shell script. Save as fanmon.sh.

Code:
#!/bin/bash

DEVICE=$1
if [ "${DEVICE}" == "" ];
then
        echo "Usage: fanmon.sh "
        exit 1
fi

# temp levels in C
# fan speeds in %
MAXTEMP=80
MAXFAN=99

MIDTEMP=60
MIDFAN=70

MINTEMP=40
MINFAN=50

IDLEFAN=20
LASTTEMP=0

export DISPLAY=:0.${DEVICE}

while true;
do
        TEMP=`aticonfig --adapter=${DEVICE} --odgt | grep Temp | sed  's/.* \([0-9]*[0-9][0-9]\)\..*/\1/'`
        if [ "${TEMP}" -ne "${LASTTEMP}" ];
        then
                echo -n "Temp: ${TEMP}C "
                if [ "${TEMP}" -gt "${MAXTEMP}" ];
                then
                        echo "setting fan speed ${MAXFAN}%"
                        aticonfig --pplib-cmd "set fanspeed 0 ${MAXFAN}"
                elif [ "${TEMP} -gt ${MIDTEMP}" ];
                then
                        echo "setting fan speed ${MIDFAN}%"
                        aticonfig --pplib-cmd "set fanspeed 0 ${MIDFAN}"
                elif [ "${TEMP} -gt ${MINTEMP}" ];
                then
                        echo "setting fan speed ${MINFAN}%"
                        aticonfig --pplib-cmd "set fanspeed 0 ${MINFAN}"
                else
                        echo "setting fan speed ${IDLEFAN}%"
                        aticonfig --pplib-cmd "set fanspeed 0 ${IDLEFAN}"
                fi
        fi
        LASTTEMP=${TEMP}
        sleep 10
done


Run it like so:
Code:
# ./fanmon.sh 0 &

Adjust the temperature thresholds so the fan speed doesn't jump up and down.