mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
* usr/lib/byobu/network:
- fix but where /proc/net/dev has so much traffic that integers run up against colons with no whitespace
This commit is contained in:
parent
5bdae6195d
commit
8be11ec0f2
2 changed files with 8 additions and 2 deletions
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -1,6 +1,9 @@
|
|||
byobu (4.13) unreleased; urgency=low
|
||||
|
||||
* UNRELEASED
|
||||
[ Scott Moser ]
|
||||
* usr/lib/byobu/network:
|
||||
- fix but where /proc/net/dev has so much traffic that integers
|
||||
run up against colons with no whitespace
|
||||
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 16 Jun 2011 11:37:56 -0500
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ fi
|
|||
|
||||
[ -d "/var/run/screen/S-$USER" ] && DIR="/var/run/screen/S-$USER" || DIR="$DATA"
|
||||
t2=`date +%s`
|
||||
OIFS=$IFS
|
||||
for i in up down; do
|
||||
unit="kbps"
|
||||
case $i in
|
||||
|
@ -54,12 +55,14 @@ for i in up down; do
|
|||
rate=0
|
||||
else
|
||||
[ -r "$cache" ] && read x1 < "$cache" || tx1=0
|
||||
IFS="$OIFS:"
|
||||
while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
|
||||
if [ "$iface" = "${interface}:" ]; then
|
||||
if [ "$iface" = "${interface}" ]; then
|
||||
[ "$i" = "up" ] && x2=${tbytes} || x2=${rbytes}
|
||||
break;
|
||||
fi
|
||||
done < /proc/net/dev
|
||||
IFS=$OIFS
|
||||
echo "$x2" > "$cache"
|
||||
rate=$((8*($x2 - $x1) / ($t2 - $t1) / 1024)) # in kbps
|
||||
[ "$rate" -lt 0 ] && rate=0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue