No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stagnetwork.sh 444B

1234567891011121314151617181920
  1. #!/bin/bash
  2. FREQUENCY=2
  3. # Use network statistics to get a sample every two seconds of average kbps
  4. downspeed()
  5. {
  6. rx1=$(cat /sys/class/net/eno1/statistics/rx_bytes)
  7. sleep $FREQUENCY
  8. rx2=$(cat /sys/class/net/eno1/statistics/rx_bytes)
  9. rxdiff=$(echo "$rx2 - $rx1" | bc -l)
  10. rxtrue=$(echo "$rxdiff/1024/$FREQUENCY" | bc -l)
  11. printf "%.0f\n" "$rxtrue"
  12. }
  13. while true;
  14. do
  15. downspeed
  16. done | stag --title "Download kbps" "$@"