Skip to content

Instantly share code, notes, and snippets.

@siberex
Last active April 21, 2024 09:17
Show Gist options
  • Save siberex/4eb55ec452a1a70127d44ca3dc4e643f to your computer and use it in GitHub Desktop.
Save siberex/4eb55ec452a1a70127d44ca3dc4e643f to your computer and use it in GitHub Desktop.
Raspberry Pi temperature monitor
#!/bin/bash
printf '%(%Y-%m-%d %H:%M:%S)T\n' -1
# Note rPi CPU and GPU are on the same chip, and GPU don't hanve any separate temperature sensor
# vcgencmd and sysfs provide the same data
cpu_temp_sysfs=$(</sys/class/thermal/thermal_zone0/temp)
echo "vcgencmd => $(vcgencmd measure_temp | grep -o -E '[[:digit:]].*')"
echo "sysfs => $((cpu_temp_sysfs/1000))'C"
# watch -c -b -d -n 1 -- './temperature.sh'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment