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

Fix vnstat config

This commit is contained in:
Ycarus 2018-12-05 13:02:38 +01:00
parent 2b652ed1e9
commit 2aeb05fae4

View file

@ -1,25 +1,31 @@
#!/bin/sh
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep wan1)" = "" ]; then
wanintf="$(uci -q get network.wan1.ifname)"
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep $wanintf)" = "" ]; then
uci -q batch <<-EOF >/dev/null
delete vnstat.@vnstat[-1]
add vnstat vnstat
set vnstat.@vnstat[-1].interface="wan1"
add_list vnstat.@vnstat[-1].interface="wan2"
commit vnstat
set vnstat.@vnstat[-1].interface=$wanintf
EOF
wanintf="$(uci -q get network.wan2.ifname)"
uci -q batch <<-EOF >/dev/null
add_list vnstat.@vnstat[-1].interface=$wanintf
EOF
if [ "$(uci -q get network.wan3)" != "" ]; then
wanintf="$(uci -q get network.wan3.ifname)"
uci -q batch <<-EOF >/dev/null
add_list vnstat.@vnstat[-1].interface="wan3"
commit vnstat
add_list vnstat.@vnstat[-1].interface=$wanintf
EOF
fi
if [ "$(uci -q get network.wan4)" != "" ]; then
wanintf="$(uci -q get network.wan4.ifname)"
uci -q batch <<-EOF >/dev/null
add_list vnstat.@vnstat[-1].interface="wan4"
commit vnstat
add_list vnstat.@vnstat[-1].interface=$wanintf
EOF
fi
uci -q batch <<-EOF >/dev/null
commit vnstat
EOF
fi
rm -f /tmp/luci-indexcache
echo '0 */2 * * * /etc/init.d/vnstat_backup backup' > /etc/crontabs/root