All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] shutdown-script using lm-sensors
@ 2009-05-25 15:29 Christian Sickau
  0 siblings, 0 replies; only message in thread
From: Christian Sickau @ 2009-05-25 15:29 UTC (permalink / raw)
  To: lm-sensors

Hi there,

I wanted to monitor the temperature of a server and shut it down 
automatically when it reaches certain threshold. At the same time it 
should keep me informed about the status via email.

I found that 
http://cahbojonegoro.wordpress.com/2008/12/15/cpu-temperature-monitor-script/
script and changed it a little:

#!/bin/sh

### Temperature Monitor
### Auto Shutdown if CPU Temperature is over threshold

## Define threshold for CPU Temperature
thresholdu

## Get CPU Temperatur using lm-sensor
t1=`/usr/bin/sensors | nawk ‘/temp2/ {print substr($2,2,2)}’`

if test $t1 -gt $threshold
then
mail -s "safety-shutdown" name@domain.de < /home/chris/heat.txt
echo “CPU Temperature is exceeding threshold – Shutting down in 10 sec …….”
sleep 10
shutdown -h now
else
mail -s "test" name@domain.de < /home/chris/textdatei.txt
echo “Temperature still on the safe range “
echo “CPU: $t1°C”
fi


Cronjob is runnig the script periodically. lm-sensors itself as well as 
the email-thing work well, but it seems that the script doesn't get the 
needed info from lm-sensors. My error-message is:

nawk: 1: unexpected character 0xe2
test: 23: 75: unexpected operator
“Temperature still on the safe range “
“CPU: °C”

Since I don't have much experience with scripts, I don't really 
understand what the problem could be. Any suggestions what do do?

I am using Ubuntu Linux 8.04.2 kernel 2.6.24-24, the mainboard is an 
Asus Pundit-R AB-P 2800 using an it8712-isa-0260 chip.**
****
**
**Thanks a lot in advance and greets from Bavaria!
**
**Chris

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-25 15:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 15:29 [lm-sensors] shutdown-script using lm-sensors Christian Sickau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.