G'day all,

I've been asked to post a copy of my emergency shutdown thingo.. so here it 
comes...
It's very, very simple.. it just parses my lmsensors output every 30 seconds 
and if the system temp 
rises above 45 degrees for more than 5 minutes it shuts the system down

[EMAIL PROTECTED]:~$ cat monitor
#!/bin/bash

let count=0
while true ; do
         temps=`sensors | grep "M/B" | awk '{print $3}' | cut -c2-`
         if [ $temps -ge "45" ] ; then
                 let count++
         else
                 let count=0
         fi;
         if [ $count -ge 10 ] ; then
                 echo `date` Trigger >> /var/log/emergency.log
                ssh [EMAIL PROTECTED] /sbin/shutdown -h now
                 sudo /sbin/shutdown -h now
         fi;

         sleep 30
done;

[EMAIL PROTECTED]:~$ sensors
it8712-isa-0290
Adapter: ISA adapter
VCore 1:   +1.76 V  (min =  +1.57 V, max =  +1.90 V)
+3.3V:     +3.38 V  (min =  +3.14 V, max =  +3.47 V)
+5V:       +4.95 V  (min =  +4.76 V, max =  +5.24 V)
+12V:     +12.35 V  (min = +11.39 V, max = +12.61 V)
Stdby:     +5.13 V  (min =  +4.76 V, max =  +5.24 V)
VBat:      +3.25 V
CPU Fan:  2596 RPM  (min = 1500 RPM, div = 4)
CPU Temp:    +41 C  (low  =   +15 C, high =   +55 C)   sensor = thermistor
M/B Temp:    +32 C  (low  =   +15 C, high =   +45 C)   sensor = thermistor
vid:       +1.20 V


-- 
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/dubailug/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to