wpj428/files/usr/sbin/wwan_traffic

13 lines
358 B
Lua
Executable file

#!/usr/bin/lua
local filesize = require "filesize"
local rxfile = io.open("/sys/class/net/wwan0/statistics/rx_bytes", "r")
local txfile = io.open("/sys/class/net/wwan0/statistics/tx_bytes", "r")
local rx = filesize(tonumber(rxfile:read("*all")))
local tx = filesize(tonumber(txfile:read("*all")))
print("RX:", rx, "TX:",tx)
rxfile:close()
txfile:close()