Created
November 6, 2018 17:08
-
-
Save xd547/fb91b834085923321dbbf7b73cb20349 to your computer and use it in GitHub Desktop.
Get Raspberry Pi temperature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GetCPUTemp() { | |
value=`cat /sys/class/thermal/thermal_zone0/temp | tr -d '\n'` | |
cpu_temp=`awk "BEGIN {print $value/1000.0}"` | |
echo "$cpu_temp" | |
} | |
GetGPUTemp() { | |
gpu_temp=`vcgencmd measure_temp |sed -e "s/temp=//g" | sed -e "s/'C//g"` | |
echo "$gpu_temp" | |
} | |
printf "CPU %.1fC GPU %.1fC\n" $(GetCPUTemp) $(GetGPUTemp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment