From bb483535fa8167c2b201b6ddeff4525a4787d3a3 Mon Sep 17 00:00:00 2001 From: bdaylik Date: Mon, 25 Mar 2024 14:14:55 +0300 Subject: [PATCH] update omr-quota to up the interface when its usage is below threshold (#309) Existing condition for the upping the interface asks for all 3 checks to have positive values (RX, TX and TT). However this is not necessary as some can be set to 0 to disable the check. This modification makes sure that if the above checks for RX, TX and TT values have failed, thus the usage is still below the set quota, the interface is set to be up. Thanks to this modification its possible to set only one check positive (e.g. TT) and let the script automatically down and up the interface as expected. --- omr-quota/files/bin/omr-quota | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omr-quota/files/bin/omr-quota b/omr-quota/files/bin/omr-quota index 61198c9fb..b615ea8f6 100755 --- a/omr-quota/files/bin/omr-quota +++ b/omr-quota/files/bin/omr-quota @@ -31,7 +31,7 @@ while true; do logger -t "OMR-QUOTA" "Set interface $OMR_QUOTA_INTERFACE down, RX+TX quota reached" ifdown $OMR_QUOTA_INTERFACE fi - elif [ -n "$OMR_QUOTA_RX" ] && [ "$OMR_QUOTA_RX" -gt 0 ] && [ -n "$OMR_QUOTA_TX" ] && [ "$OMR_QUOTA_TX" -gt 0 ] && [ -n "$OMR_QUOTA_TT" ] && [ "$OMR_QUOTA_TT" -gt 0 ] && [ "$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.up')" = "false" ]; then + elif [ "$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.up')" = "false" ]; then logger -t "OMR-QUOTA" "Set interface $OMR_QUOTA_INTERFACE up" ifup $OMR_QUOTA_INTERFACE fi