Hi,
I want to get all the static routes added in my router & need to call "network restart" to reflect the static routes in console. I'm using a shell script to do it. I'm facing trouble in accessing the index of "route" in "network" configuration via using uci. Here's my code -
route_num=`ubus call network.interface.lan status | jsonfilter -e '@["route"]' | grep -o "mask" | wc -l`
cnt=0
for i in {0..$route_num}; do
dest=`uci -q get network.@route[].dest`
state=`uci -q get network.@route[].disabled`
if [ "$dest" != "" ] && [ "$state" = "0" ]; then
cnt=$((cnt + 1))
fi
done
if [ "$cnt" -gt 0 ]; then
touch /tmp/route_updated
echo "updated route" >> /tmp/route_updated
/etc/init.d/network restart
fi
Pls suggest the right way to access indexes of "static route". Thanks in advance.