mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
29 lines
771 B
Bash
Executable file
29 lines
771 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ "$(uci -q get vnstat.@vnstat[-1].interface | grep wan1)" = "" ]; 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
|
|
EOF
|
|
if [ "$(uci -q get network.wan3)" != "" ]; then
|
|
uci -q batch <<-EOF >/dev/null
|
|
add_list vnstat.@vnstat[-1].interface="wan3"
|
|
commit vnstat
|
|
EOF
|
|
fi
|
|
if [ "$(uci -q get network.wan4)" != "" ]; then
|
|
uci -q batch <<-EOF >/dev/null
|
|
add_list vnstat.@vnstat[-1].interface="wan4"
|
|
commit vnstat
|
|
EOF
|
|
fi
|
|
fi
|
|
rm -f /tmp/luci-indexcache
|
|
if [ "$(grep -q vnstat_backup /etc/crontabs/root)" = "" ]; then
|
|
echo '* */12 * * * /etc/init.d/vnstat_backup backup' >> /etc/crontabs/root
|
|
fi
|
|
|
|
exit 0
|