stats.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. #interfaces:
  3. #ifconfig -a | sed 's/[ \t].*//;/^$/d' | grep -v "lo" | tr -d ":"
  4. #ip for interface:
  5. #ip address show dev vcn scope global | awk '/inet / {split($2,var,"/"); print var[1]}'
  6. spacer=" "
  7. while true; do
  8. freq_raw=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
  9. temp=$(vcgencmd measure_temp)
  10. volt=$(vcgencmd measure_volts)
  11. freq=$(( $freq_raw / 1000 ))
  12. echo "System stats:"
  13. echo " "$(uptime)
  14. echo " ---"
  15. echo "Raspi stats:"
  16. echo " freq="$freq"mhz"
  17. echo " "$temp
  18. echo " "$volt
  19. echo " ---"
  20. echo "Net stats:"
  21. for interface in $(ifconfig -a | sed 's/[ \t].*//;/^$/d' | grep -v "lo" | tr -d ":")
  22. do
  23. echo " "$interface": "$(ip address show dev $interface scope global | awk '/inet / {split($2,var,"/"); print var[1]}')
  24. done
  25. echo " ---"
  26. sleep 5
  27. clear
  28. # # \r is a "carriage return" - returns cursor to start of line
  29. # printf "\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS
  30. # In the following line -t for timeout, -N for just 1 character
  31. read -t 0.25 -N 1 input
  32. if [[ $input = "q" ]] || [[ $input = "Q" ]]; then
  33. # The following line is for the prompt to appear on a new line.
  34. echo
  35. break
  36. fi
  37. done