Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to obtain/cat CPU Core Temp from ISA Adapter?

I'm building a script in Linux to monitor my active core temps;

Then manually enable the ACPI Fan on the event when the CORE 0 TEMP hits 40 Degrees.

I have already built the fan script that works on demand by hitting a command into the bash terminal for simplicity it is called fanon.

However I want to know how to CAT this CORE 0 temp output to a variable in a bash script called gettemp, that updates on an interval say every 2 seconds.

By using watch sensors I get the following output in the terminal.
acpitz-virtual-0
Adapter: Virtual device
temp1: +45.0°C (crit = +256.0°C)
temp2: +36.0°C (crit = +105.0°C)
temp3: +32.0°C (crit = +105.0°C)
temp4: +24.1°C (crit = +105.0°C)
temp5: +100.0°C (crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0: +41.0°C (crit = +100.0°C) <--- This is the temp I need!
Core 1: +38.0°C (crit = +100.0°C)


Core 0 Temp needs to be found in a way so that I can do the following:
Core0Temp=$(cat /PATH/TO/ISA/TEMP/GOES/HERE)
Core1Temp=$(cat /PATH/TO/ISA/TEMP2/GOES/HERE)


And then from that I can do
if [ $Core0Temp -gt "40" ]; then
echo "Exceeding Temp Value. Enabling Fan."
/var/tempmon/fanon
elif [ $Core0Temp -lt "40" ]; then
echo "Turning Fan Off."
/var/tempmon/fanoff
fi

It has poor (manufacturers) ability handling of ACPI Thermal Events and its connection to the ACPI Fan, is diabolical. Many searches on Google have only showed me how to manually enable the cooling system. As shown below.
echo "Enabling ACPI FAN... "
echo 1 > /sys/class/thermal/cooling_device2/cur_state
echo "Fan Enabled... "

To disable the fan, the following is executed by sudo.

echo "Disabling ACPI FAN..."
echo 0 > /sys/class/thermal/cooling_device2/cur_state
echo "Fan Disabled..."


So I need to build this script to enable the thermal chip to report the temp, and enable the fan accordingly, like you would expect on any bog standard laptop. I just can't find where the actual core temps are located. Watch sensors can find them but I can't.
by

1 Answer

Bharatgxwzm
If you have sysfs mounted, which you should by default, you can find the temp readout in /sys/class/thermal/thermal_zoneX/temp.

On my machine the following did the trick
$ cat /sys/class/thermal/thermal_zone0/temp
27800
$ cat /sys/class/thermal/thermal_zone1/temp
29800
$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +27.8°C (crit = +105.0°C)
temp2: +29.8°C (crit = +105.0°C)

Login / Signup to Answer the Question.