update again cpu temp cmd

This commit is contained in:
Hristo Jelev
2021-10-06 00:01:03 +03:00
parent c00490fa82
commit e298c4da3f
2 changed files with 2 additions and 2 deletions

0
null Normal file
View File

View File

@@ -52,12 +52,12 @@ def check_memory():
return memory return memory
def check_cpu_temp(): def check_cpu_temp():
full_cmd = "cat /sys/class/thermal/thermal_zone*/temp | sed 's/\(.\)..$//' | tail -n 1" full_cmd = "cat /sys/class/thermal/thermal_zone*/temp 2> /dev/null | sed 's/\(.\)..$//' | tail -n 1"
try: try:
p = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0] p = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
cpu_temp = p.decode("utf-8").replace('\n', ' ').replace('\r', '') cpu_temp = p.decode("utf-8").replace('\n', ' ').replace('\r', '')
except: except:
cpu_temp = 0 cpu_temp = 0
return cpu_temp return cpu_temp
def check_sys_clock_speed(): def check_sys_clock_speed():