diff options
author | Cody Hiar <codyfh@gmail.com> | 2017-04-20 19:37:10 -0600 |
---|---|---|
committer | Cody Hiar <codyfh@gmail.com> | 2017-04-20 19:37:10 -0600 |
commit | 2dd809781527976307b47a598887062047e202c9 (patch) | |
tree | 8b29daba2c1ef072f380ef530b7e7d9256e43eb3 /segments/ifstat_sys.sh | |
parent | baeb698bb006193559fc5aa1901180a3ccc73b7a (diff) |
Making tmux configuration much easier to manage
Diffstat (limited to 'segments/ifstat_sys.sh')
-rwxr-xr-x | segments/ifstat_sys.sh | 28 |
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 -} |