From 367ea040f2b25b06f30b5feafb378e182feb32da Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 13 May 2024 11:41:13 +0200 Subject: [PATCH] Fix interface in OMR-Quota --- omr-quota/files/bin/omr-quota | 1 + omr-quota/files/etc/init.d/omr-quota | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/omr-quota/files/bin/omr-quota b/omr-quota/files/bin/omr-quota index b615ea8f6..da028a902 100755 --- a/omr-quota/files/bin/omr-quota +++ b/omr-quota/files/bin/omr-quota @@ -11,6 +11,7 @@ shift # main loop while true; do 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"` 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)) diff --git a/omr-quota/files/etc/init.d/omr-quota b/omr-quota/files/etc/init.d/omr-quota index 37700ff50..cc3698655 100755 --- a/omr-quota/files/etc/init.d/omr-quota +++ b/omr-quota/files/etc/init.d/omr-quota @@ -18,8 +18,9 @@ _validate_section() { _launch_quota() { local txquota rxquota ttquota interval enabled interface _validate_section "interface" "$1" - interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') - [ -n "$(echo $interface | grep '@')" ] && interface=$(ifstatus "$1" | jsonfilter -q -e '@["device"]') + interface=$1 + #interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + #[ -n "$(echo $interface | grep '@')" ] && interface=$(ifstatus "$1" | jsonfilter -q -e '@["device"]') [ -z "$interface" ] && return