Last active
July 1, 2021 14:37
-
-
Save ethzero/34eca1dba5f36f858e551ec57c49b112 to your computer and use it in GitHub Desktop.
Get power, ARM frequency, CPU throttle, and temperature status of a Raspberry Pi 4
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/bash | |
# Source/credit: https://www.raspberrypi.org/forums/viewtopic.php?t=254024 | |
STATUS=$(vcgencmd get_throttled | sed -n 's|^throttled=\(.*\)|\1|p') | |
if [[ ${STATUS} -ne 0 ]]; then | |
echo "" | |
if [ $((${STATUS} & 0x00001)) -ne 0 ]; then | |
echo "Power is currently Under Voltage" | |
elif [ $((${STATUS} & 0x10000)) -ne 0 ]; then | |
echo "Power has previously been Under Voltage" | |
fi | |
if [ $((${STATUS} & 0x00002)) -ne 0 ]; then | |
echo "ARM Frequency is currently Capped" | |
elif [ $((${STATUS} & 0x20000)) -ne 0 ]; then | |
echo "ARM Frequency has previously been Capped" | |
fi | |
if [ $((${STATUS} & 0x00004)) -ne 0 ]; then | |
echo "CPU is currently Throttled" | |
elif [ $((${STATUS} & 0x40000)) -ne 0 ]; then | |
echo "CPU has previously been Throttled" | |
fi | |
if [ $((${STATUS} & 0x00008)) -ne 0 ]; then | |
echo "Currently at Soft Temperature Limit" | |
elif [ $((${STATUS} & 0x80000)) -ne 0 ]; then | |
echo "Previously at Soft Temperature Limit" | |
fi | |
echo "" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment