1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 19:11:51 +00:00
openmptcprouter-feeds/openmptcprouter/files/etc/uci-defaults/1970-omr-vnstat
2018-11-08 21:29:35 +01:00

27 lines
701 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
echo '0 */2 * * * /etc/init.d/vnstat_backup backup' > /etc/crontabs/root
exit 0