aboutsummaryrefslogtreecommitdiff
path: root/segments/ifstat_sys.sh
diff options
context:
space:
mode:
Diffstat (limited to 'segments/ifstat_sys.sh')
-rwxr-xr-xsegments/ifstat_sys.sh28
1 files changed, 0 insertions, 28 deletions
diff --git a/segments/ifstat_sys.sh b/segments/ifstat_sys.sh
deleted file mode 100755
index 1059dc4..0000000
--- a/segments/ifstat_sys.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-# Show if stats by sampling /sys/.
-# Originally stolen from http://unix.stackexchange.com/questions/41346/upload-download-speed-in-tmux-status-line
-
-run_segment() {
- sleeptime="0.5"
- iface="eth0"
- RXB=$(</sys/class/net/"$iface"/statistics/rx_bytes)
- TXB=$(</sys/class/net/"$iface"/statistics/tx_bytes)
- sleep "$sleeptime"
- RXBN=$(</sys/class/net/"$iface"/statistics/rx_bytes)
- TXBN=$(</sys/class/net/"$iface"/statistics/tx_bytes)
- RXDIF=$(echo "$((RXBN - RXB)) / 1024 / ${sleeptime}" | bc )
- TXDIF=$(echo "$((TXBN - TXB)) / 1024 / ${sleeptime}" | bc )
-
- if [ $RXDIF -gt 1024 ]; then
- RXDIF_ECHO="↓ $(echo "scale=1;${RXDIF} / 1024" | bc)M/s"
- else
- RXDIF_ECHO="↓ ${RXDIF}K/s"
- fi
- if [ $TXDIF -gt 1024 ]; then
- TXDIF_ECHO="↑ $(echo "scale=1;${TXDIF} / 1024" | bc)M/s"
- else
- TXDIF_ECHO="↑ ${TXDIF}K/s"
- fi
-
- echo -e "${RXDIF_ECHO} ${TXDIF_ECHO}"
- return 0
-}