Skip to content

Instantly share code, notes, and snippets.

@ofalvai
Created July 2, 2013 20:02
Show Gist options
  • Save ofalvai/5912612 to your computer and use it in GitHub Desktop.
Save ofalvai/5912612 to your computer and use it in GitHub Desktop.
My little script to check the Raspberry Pi's status over SSH.
#!/bin/bash
let freq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)/1000
temp=$(vcgencmd measure_temp)
temp=${temp:5}
wifi=$(cat /proc/net/wireless | grep wlan0 | awk {'print $4'} | tr -d .)
read one five fifteen rest < /proc/loadavg
uptime=$(uptime | awk '{print $3}' | tr -d ,)
card=$(df -h | grep -E '^/dev/mmcblk0p2')
used=$(echo $card | awk '{print $3}')
free=$(echo $card | awk '{print $4}')
percent=$(echo $card | awk '{print $5}')
echo "CPU.......: $freq MHz"
echo "Temp......: $temp"
echo "WiFi......: $wifi%"
echo "Load......: $one, $five, $fifteen"
echo "Uptime....: $uptime"
echo "SD card...: $used used ($percent), $free free"
if [[ -n $(pgrep xbmc.bin) ]]; then
echo -e "XBMC......: \e[00;32mRunning\e[00m"
else
echo -e "XBMC......: \e[00;31mStopped\e[00m"
fi
@ofalvai
Copy link
Author

ofalvai commented Jul 2, 2013

Sample screenshot:
Screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment