nettraf
This commit is contained in:
parent
ae8929205e
commit
0df700f504
1 changed files with 2 additions and 2 deletions
|
@ -14,12 +14,12 @@ update() {
|
||||||
sum=0
|
sum=0
|
||||||
for arg; do
|
for arg; do
|
||||||
read -r i < "$arg"
|
read -r i < "$arg"
|
||||||
sum=$(( $sum + $i ))
|
sum=$(( sum + i ))
|
||||||
done
|
done
|
||||||
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
|
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
|
||||||
[ -f "$cache" ] && read -r old < "$cache" || old=0
|
[ -f "$cache" ] && read -r old < "$cache" || old=0
|
||||||
printf %d\\n "$sum" > "$cache"
|
printf %d\\n "$sum" > "$cache"
|
||||||
printf %d\\n $(( ($sum - $old) / 1024 ))
|
printf %d\\n $(( (sum - old) / 1024 ))
|
||||||
}
|
}
|
||||||
|
|
||||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||||
|
|
Loading…
Reference in a new issue