1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add interface in vnstat only if enabled in quota

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-04-05 16:01:20 +02:00
parent dc2d57d960
commit 17670c520e

View file

@ -21,16 +21,16 @@ _launch_quota() {
interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -z "$interface" ] && return [ -z "$interface" ] && return
[ -z "$txquota" ] && [ -z "$rxquota" ] && [ -z "$ttquota" ] && return
[ "$enabled" = "0" ] && return
[ "$(uci get vnstat.@vnstat[-1].interface | grep $interface)" = "" ] && { [ "$(uci get vnstat.@vnstat[-1].interface | grep $interface)" = "" ] && {
uci -q batch <<-EOF uci -q batch <<-EOF
add_list vnstat.@vnstat[-1].interface=$interface add_list vnstat.@vnstat[-1].interface=$interface
EOF EOF
} }
[ -z "$txquota" ] && [ -z "$rxquota" ] && [ -z "$ttquota" ] && return
[ "$enabled" = "0" ] && return
procd_open_instance procd_open_instance
procd_set_param command /bin/omr-quota "$interface" procd_set_param command /bin/omr-quota "$interface"
procd_append_param env "OMR_QUOTA_TX=$txquota" procd_append_param env "OMR_QUOTA_TX=$txquota"