From: Christian Sickau <christian.sickau@gmx.de>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] shutdown-script using lm-sensors
Date: Mon, 25 May 2009 15:29:22 +0000 [thread overview]
Message-ID: <4A1AB952.9020706@gmx.de> (raw)
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
reply other threads:[~2009-05-25 15:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A1AB952.9020706@gmx.de \
--to=christian.sickau@gmx.de \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.