LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-18-2011, 06:02 PM   #1
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Rep: Reputation: 51
Temp script to minus value to display in conky?


Hello,

I have an K10 AMD CPU and unfortunately it has a borked temp sensor. I have figured out that if I subtract 8 from value stored in /proc/acpi/thermal_zone/temperature that the result is very close to being spot on. The problem is I have no idea to do this and conky has no built in way to do this.

The data stored in /proc/acpi/thermal_zone/temperature looks like this:

Code:
temperature:             52 C
Is there some sort of script that can do this?

Thanks in advance!
 
Old 01-18-2011, 06:22 PM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
You could use the exec command to run a bash script to do it for you man
 
Old 01-18-2011, 06:25 PM   #3
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
And by the way, I would definitely whip up a quick script for you, but I'm at work, and the military computers run f*cking windows >:O
 
Old 01-18-2011, 06:25 PM   #4
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by corp769 View Post
You could use the exec command to run a bash script to do it for you man
I know that.

The problem is the script?

---------- Post added 01-18-11 at 07:26 PM ----------

Quote:
Originally Posted by corp769 View Post
And by the way, I would definitely whip up a quick script for you, but I'm at work, and the military computers run f*cking windows >:O
LOL.

I hear that!
 
Old 01-18-2011, 06:33 PM   #5
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
And dude, I am so not relying on google to create a script. I can't even ssh into my god damn server, because they realized what I was doing for the past 5 years, and decided to put an end to that.... You in the military too? Or you just saying you hear that cause im bitching about windows? LOL
 
Old 01-18-2011, 06:36 PM   #6
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by corp769 View Post
And dude, I am so not relying on google to create a script. I can't even ssh into my god damn server, because they realized what I was doing for the past 5 years, and decided to put an end to that.... You in the military too? Or you just saying you hear that cause im bitching about windows? LOL
The whole windows bit....

I feel bad for anyone that "has" to use it! LOL
 
Old 01-18-2011, 06:43 PM   #7
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
Thanks for your sympathy!
 
Old 01-18-2011, 06:50 PM   #8
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
But anyway, i'm gonna give this a shot... Can you post the contents of the /proc/acpi/thermal_zone/temperature file?
 
Old 01-18-2011, 07:00 PM   #9
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by corp769 View Post
But anyway, i'm gonna give this a shot... Can you post the contents of the /proc/acpi/thermal_zone/temperature file?
Code:
temperature:             52 C
Thats all there is, of course it changes.
 
Old 01-18-2011, 07:39 PM   #10
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Ok, I got this that will extract the value, how do I get it to subtract 8 from the value to post the result to conky?

Code:
#!/bin/bash

grep -oE "[[:digit:]]{1,}" /proc/acpi/thermal_zone/temperature
 
Old 01-18-2011, 08:04 PM   #11
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
alright, well i've been working on my some-what own, between google, my experience, and hope...... lmao....

Code:
#!/bin/bash
temp1=sed -n 's/temperature:[[:space:]]*//p' /proc/acpi/thermal_zone/temperature | tr -d [:cntrl:][:space:] | cut -c1-2
echo $temp1
echo $((temp1-8))
run that just to test, and pray... LOL
 
Old 01-18-2011, 08:11 PM   #12
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Gives an error:

Code:
[ron@iggy scripts]$ sh temps
sed -n 's/temperature:[[:space:]]*//p' /proc/acpi/thermal_zone/temperature | tr -d [:cntrl:][:space:] | cut -c1-2
temps: line 4: sed -n 's/temperature:[[:space:]]*//p' /proc/acpi/thermal_zone/temperature | tr -d [:cntrl:][:space:] | cut -c1-2: syntax error: invalid arithmetic operator (error token is "'s/temperature:[[:space:]]*//p' /proc/acpi/thermal_zone/temperature | tr -d [:cntrl:][:space:] | cut -c1-2")
 
Old 01-18-2011, 08:19 PM   #13
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995Reputation: 995
For the hell of it, try yours and see what works:

Code:
#!/bin/bash
temp1=grep -oE "[[:digit:]]{1,}" /proc/acpi/thermal_zone/temperature
echo $temp1
echo $((temp1-8))
 
Old 01-18-2011, 08:25 PM   #14
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Still giving an error. Strange thing is my command actually gives the result outside the script.

in script:

Code:
sh temps
grep -oE [[:digit:]]{1,} /proc/acpi/thermal_zone/temperature
temps: line 4: grep -oE [[:digit:]]{1,} /proc/acpi/thermal_zone/temperature: syntax error: invalid arithmetic operator (error token is "[[:digit:]]{1,} /proc/acpi/thermal_zone/temperature")
And in term:

Code:
[ron@iggy scripts]$ grep -oE "[[:digit:]]{1,}" /proc/acpi/thermal_zone/temperature
51
 
Old 01-18-2011, 08:26 PM   #15
corbintechboy
Member
 
Registered: Sep 2003
Location: Kentucky
Posts: 480
Blog Entries: 1

Original Poster
Rep: Reputation: 51
Yours works right outside of script as well:

Code:
[ron@iggy scripts]$ sed -n 's/temperature:[[:space:]]*//p' /proc/acpi/thermal_zone/temperature | tr -d [:cntrl:][:space:] | cut -c1-2
52
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
conky question: passing conky-variable to shell-script zlin50 Linux - Software 2 12-29-2012 06:47 PM
[SOLVED] How do I display external IP address in Conky? PClOStinspace Linux - Software 2 11-27-2010 11:58 AM
Conky temp configuration Deonild Linux - Software 1 04-14-2009 04:59 PM
Incoming connections won't display in conky Decalore Slackware 8 09-12-2008 10:37 AM
Script to change date in filename minus one day ft77 Linux - General 3 06-02-2006 09:56 AM


All times are GMT -5. The time now is 11:09 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration