Nebkas : Control LED by CPU temperature

Hi folks!

Today I wrote a simple script for showing the CPU temperature by using the green LED

0-39° = LED OFF 40-49°C = LED heartbeat over 50°C = LED on

You need the “lm-sensors” package(apt-get install lm-sensors)

greetz

Nebkas

 #!/bin/zsh

 while
 do

 temp=$( sensors | grep temp | cut -c16-17 )
 clear

 if [ $temp -le 39 ]
 then
     echo -e "Aktuelle Temperatur: " "\e[32m$temp" "\e[0m°C"
         echo none > /sys/class/leds/green\:ph24\:led1/trigger
 elif [ $temp -le 49 ]

 then
     echo "Aktuelle Temperatur: " "\e[33m$temp" "\e[0m°C"
         echo heartbeat > /sys/class/leds/green\:ph24\:led1/trigger

 else
     echo "Aktuelle Temperatur: " "\e[31m$temp" "\e[0m°C"
         echo default-on > /sys/class/leds/green\:ph24\:led1/trigger

 fi

 sleep 1

 done

link: http://www.lemaker.org/thread-22441-1-1.html