LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Temp script to minus value to display in conky? (https://www.linuxquestions.org/questions/linux-general-1/temp-script-to-minus-value-to-display-in-conky-857123/)

corbintechboy 01-18-2011 06:02 PM

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!

corp769 01-18-2011 06:22 PM

You could use the exec command to run a bash script to do it for you man

corp769 01-18-2011 06:25 PM

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

corbintechboy 01-18-2011 06:25 PM

Quote:

Originally Posted by corp769 (Post 4229375)
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 (Post 4229376)
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!

corp769 01-18-2011 06:33 PM

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

corbintechboy 01-18-2011 06:36 PM

Quote:

Originally Posted by corp769 (Post 4229386)
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

corp769 01-18-2011 06:43 PM

Thanks for your sympathy! :D

corp769 01-18-2011 06:50 PM

But anyway, i'm gonna give this a shot... Can you post the contents of the /proc/acpi/thermal_zone/temperature file?

corbintechboy 01-18-2011 07:00 PM

Quote:

Originally Posted by corp769 (Post 4229400)
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.

corbintechboy 01-18-2011 07:39 PM

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


corp769 01-18-2011 08:04 PM

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

corbintechboy 01-18-2011 08:11 PM

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")


corp769 01-18-2011 08:19 PM

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))


corbintechboy 01-18-2011 08:25 PM

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


corbintechboy 01-18-2011 08:26 PM

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



All times are GMT -5. The time now is 05:47 AM.