mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 10:31:51 +00:00
Fix interface in OMR-Quota
This commit is contained in:
parent
140649c2eb
commit
367ea040f2
2 changed files with 4 additions and 2 deletions
|
@ -11,6 +11,7 @@ shift
|
||||||
# main loop
|
# main loop
|
||||||
while true; do
|
while true; do
|
||||||
OMR_QUOTA_REAL_INTERFACE="$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.l3_device')"
|
OMR_QUOTA_REAL_INTERFACE="$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.l3_device')"
|
||||||
|
[ -n "$(echo $OMR_QUOTA_INTERFACE | grep '@')" ] && OMR_QUOTA_REAL_INTERFACE=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
||||||
rx_bits=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].rx' | tr -d "\n"`
|
rx_bits=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].rx' | tr -d "\n"`
|
||||||
tx_bits=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].tx' | tr -d "\n"`
|
tx_bits=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].tx' | tr -d "\n"`
|
||||||
rx=$((rx_bits/1024))
|
rx=$((rx_bits/1024))
|
||||||
|
|
|
@ -18,8 +18,9 @@ _validate_section() {
|
||||||
_launch_quota() {
|
_launch_quota() {
|
||||||
local txquota rxquota ttquota interval enabled interface
|
local txquota rxquota ttquota interval enabled interface
|
||||||
_validate_section "interface" "$1"
|
_validate_section "interface" "$1"
|
||||||
interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
interface=$1
|
||||||
[ -n "$(echo $interface | grep '@')" ] && interface=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
#interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||||
|
#[ -n "$(echo $interface | grep '@')" ] && interface=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
|
||||||
|
|
||||||
[ -z "$interface" ] && return
|
[ -z "$interface" ] && return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue