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