Skip to content

Instantly share code, notes, and snippets.

@jostyee
Forked from dchakro/pi.status.sh
Created May 16, 2020 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jostyee/360a665ea69c6d678c8653a9c3cb1bb6 to your computer and use it in GitHub Desktop.
Save jostyee/360a665ea69c6d678c8653a9c3cb1bb6 to your computer and use it in GitHub Desktop.
Shell script to print stats about a Raspberry running pihole
# Gather system details.
dt=$(date -R)
freq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
volts=$(sudo /opt/vc/bin/vcgencmd measure_volts)
temp=$(sudo /opt/vc/bin/vcgencmd measure_temp)
gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
up=$(uptime)
# Print System details
echo " "
echo -e "\e[42m$dt\e[0m"
echo " "
echo "$volts"
echo "$temp"
# sudo /opt/vc/bin/vcgencmd measure_clock
freq=$((freq/1000))
echo -e "CPU Governor=\e[91m$gov\e[0m"
echo -e "Current speed=\e[96m$freq MHz\e[0m"
echo " "
# Print free & used RAM
echo "RAM"
free | awk '/Mem/{printf("%.2f MB used\n"), $3/1024}'
free | awk '/Mem/{printf("%.2f MB free\n"), $4/1024}'
# print pihole status directly from pihole CLI
echo " "
pihole status
echo " "
# Check system status.
# Requires package dnsutils on linux.
dig google.com +noall +stats +answer
echo " "
# print system uptime
echo -e "\e[101m $up \e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment