calibrate CPUTempShutdown

frenchie
Member
Member
Posts: 4
Joined: October 21st, 2014, 1:28 pm

calibrate CPUTempShutdown

Postby frenchie » October 21st, 2014, 1:35 pm

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

User avatar
Ian
Moderator
Posts: 751
Joined: January 1st, 2011, 8:00 am

Re: calibrate CPUTempShutdown

Postby Ian » October 21st, 2014, 7:46 pm

Hi,

What error message comes back when you run the script?

Ian.

frenchie
Member
Member
Posts: 4
Joined: October 21st, 2014, 1:28 pm

Re: calibrate CPUTempShutdown

Postby frenchie » October 22nd, 2014, 9:19 am

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

User avatar
Ian
Moderator
Posts: 751
Joined: January 1st, 2011, 8:00 am

Re: calibrate CPUTempShutdown

Postby Ian » October 22nd, 2014, 7:02 pm

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.

frenchie
Member
Member
Posts: 4
Joined: October 21st, 2014, 1:28 pm

Re: calibrate CPUTempShutdown

Postby frenchie » November 4th, 2014, 8:21 pm

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.

User avatar
Ian
Moderator
Posts: 751
Joined: January 1st, 2011, 8:00 am

Re: calibrate CPUTempShutdown

Postby Ian » November 4th, 2014, 8:57 pm

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?

frenchie
Member
Member
Posts: 4
Joined: October 21st, 2014, 1:28 pm

Re: calibrate CPUTempShutdown

Postby frenchie » November 4th, 2014, 10:26 pm

No it didn't do anything new, but i will try again tomorrow


Return to “General Discussion”

cron