Created
May 13, 2020 10:53
-
-
Save albertobissacco/16ae842559b3baabdbbaa17f03b1b85c to your computer and use it in GitHub Desktop.
Raspberry Pi CPU and GPU Temperature
This file contains hidden or 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/bash | |
| cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp) | |
| cpuTemp1=$(($cpuTemp0/1000)) | |
| cpuTemp2=$(($cpuTemp0/100)) | |
| cpuTempM=$(($cpuTemp2 % $cpuTemp1)) | |
| cpuTemp="${cpuTemp1}.${cpuTempM}" | |
| gpuTemp=$(/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9") | |
| red=`tput setaf 9` | |
| grey=`tput dim` | |
| reset=`tput sgr0` | |
| echo -e "${grey}$(date '+%Y-%m-%d %H:%M:%S')${reset} Temp: CPU: ${red}${cpuTemp}ºC${reset}, GPU: ${red}${gpuTemp}ºC${reset}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment