Page 1 of 1

CPU Shutdown Sh

Posted: April 10th, 2013, 11:03 pm
by SergeantBort
I am trying to get my new server to run a shutdown script, but the sensors for the CPU do not display as "Core #" instead I have

Below is my sensor output

Code: Select all

k10temp-pci-00c3
Adapter: PCI adapter
temp1:        +14.9°C  (high = +70.0°C)
                       (crit = +80.0°C, hyst = +77.0°C)

fam15h_power-pci-00c4
Adapter: PCI adapter
power1:       32.89 W  (crit =  94.99 W)

f71889a-isa-0480
Adapter: ISA adapter
+3.3V:        +3.33 V
in1:          +0.91 V  (max =  +2.04 V)
in2:          +1.11 V
in3:          +0.87 V
in4:          +0.62 V
in5:          +1.36 V
in6:          +1.69 V
3VSB:         +3.34 V
Vbat:         +3.33 V
fan1:        3579 RPM
fan2:         778 RPM
fan3:           0 RPM  ALARM
temp1:        +27.0°C  (high = +85.0°C, hyst = +81.0°C)
                       (crit = +80.0°C, hyst = +76.0°C)  sensor = transistor
temp2:        +35.0°C  (high = +85.0°C, hyst = +79.0°C)
                       (crit = +109.0°C, hyst = +103.0°C)  sensor = thermistor
temp3:        +37.0°C  (high = +70.0°C, hyst = +68.0°C)
                       (crit = +85.0°C, hyst = +83.0°C)  sensor = transistor

nouveau-pci-0100
Adapter: PCI adapter
temp1:        +60.0°C  (high = +100.0°C, crit = +120.0°C)


I am assuming f71889a-isa-0480 is my CPU (it's an AMD hexa core) and the three temp's are referencing three temp readings on the chip, so that's what I want to base this script on.

So I edited the script to read

Code: Select all

  
  str=$(sensors | grep "temp$i:")
  newstr=${str:15:2}


Which when I run ./CPUTempShutdown.sh 30 5000 (trying a high number for testing this because i've accidently shut it down twice now, and dont feel like walking back to my box to shut it down...

For some reason when I run that, it's pulling temp 2 and 3 correct, but temp1 is pulling 15 from the first reading of temp1 in the sensor output... any suggestions here??? Although it seems to be the coolest reading so the other two should get higher first.. but if at all possible i would like all three to read properly..

Re: CPU Shutdown Sh

Posted: April 29th, 2013, 2:02 am
by ricksebak
This is a few weeks old so maybe you've already solved this.

But when your script runs 'sensors | grep Temp1' (in the part of the loop where Temp$i == Temp1), grep will grab any reference to Temp1. It's probably grabbing Temp1 from k10temp-pci-00c3 instead of from the desired f71889a-isa-0480. Try using 'sensors f71889a-isa-0480 | grep Temp$i' instead, to tell sensors which particular chip to read from.

Also, if the point of this script is to shutdown the server if it reaches a high temperature, your BIOS can probably handle that for you without any script at all.