Page 1 of 1

calibrate CPUTempShutdown

Posted: October 21st, 2014, 1:35 pm
by frenchie
Hi,

I know this question has been asked several times but in can't get it to work so,

that's what my sensor get me

Code: Select all

acpitz-virtual-0
Adapter: Virtual device
temp1:         +8.0°C  (crit = +90.0°C)

k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp:   +20.0°C
Core0 Temp:   +23.0°C
Core1 Temp:   +17.0°C
Core1 Temp:   +18.0°C
and i've change the code on

Code: Select all

str=$(sensors | grep "Core$i Temp:")
  newstr=${str:15:2}
but it still doesn't work. :evil:

i'm kind of a linux newbee sorry....

thanks for your help and great website, i've already done 3 different server :D

Re: calibrate CPUTempShutdown

Posted: October 21st, 2014, 7:46 pm
by Ian
Hi,

What error message comes back when you run the script?

Ian.

Re: calibrate CPUTempShutdown

Posted: October 22nd, 2014, 9:19 am
by frenchie

Code: Select all

JOB RUN AT mercredi 22 octobre 2014, 10:17:04 (UTC+0200)
=======================================

CPU Warning Limit set to => 45
CPU Shutdown Limit set to => 55


acpitz-virtual-0
Adapter: Virtual device
temp1:         +7.0°C  (crit = +90.0°C)

k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp:   +20.0°C
Core0 Temp:   +21.0°C
Core1 Temp:   +17.0°C
Core1 Temp:   +16.0°C



/home/coloc/MyScripts/CPUTempShutdown.sh: ligne 49 : [: -ge : opérateur unaire attendu
 Temperature Core 0 OK at =>

/home/coloc/MyScripts/CPUTempShutdown.sh: ligne 49 : [: -ge : opérateur unaire attendu
 Temperature Core 1 OK at =>

Both CPU Cores are within limits
i got that as a reply :twisted:

thanks

Re: calibrate CPUTempShutdown

Posted: October 22nd, 2014, 7:02 pm
by Ian
Thanks.

Please paste the following two lines immediately after the line which reads newstr=${str:15:2} in your script and paste the output in your next post please.

Code: Select all

echo $str
echo $newstr
To save time it might be helpful if you paste the whole script too (removing your email address from your post)

Thanks.

Ian.

Re: calibrate CPUTempShutdown

Posted: November 4th, 2014, 7:21 pm
by frenchie

Code: Select all

echo "JOB RUN AT $(date)"
echo "======================================="

echo ''
echo 'CPU Warning Limit set to => '$1
echo 'CPU Shutdown Limit set to => '$2
echo ''
echo ''

sensors


echo ''
echo ''

for i in 0 1
do

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

echo $str
echo $newstr

  if [ ${newstr} -ge $1 ]
  then
       echo '============================'
    echo ''
    echo 'CRITICAL: TEMPERATURE CORE' $i 'EXCEEDED' $2 '=>' $newstr
    echo ''
    echo '============================'
    /usr/sbin/ssmtp emailadresse </home/coloc/MyScripts/msgtempwarning.txt
    echo 'Email Sent.....'

     exit
  fi

  if [ ${newstr} -ge $2 ]
  then
    echo '============================'
    echo ''
    echo 'CRITICAL: TEMPERATURE CORE' $i 'EXCEEDED' $2 '=>' $newstr
    echo ''
    echo '============================'
    /sbin/shutdown -h now
    /usr/sbin/ssmtp emailadresse </home/coloc/MyScripts/msgtempshutdown.txt
    echo 'Email Sent.....'
    exit
  else
    echo ' Temperature Core '$i' OK at =>' $newstr
    echo ''
  fi
done

echo 'Both CPU Cores are within limits'
echo ''

sorry i couldn't reply i was in holydays.

Re: calibrate CPUTempShutdown

Posted: November 4th, 2014, 7:57 pm
by Ian
Hi, no need to apologise.

When you now run it you should see extra output (from those two extra lines you pasted into the script). What does it now show?

Re: calibrate CPUTempShutdown

Posted: November 4th, 2014, 9:26 pm
by frenchie
No it didn't do anything new, but i will try again tomorrow