#!/bin/sh
# Monitor route table, and remove any default routes through eth0.
# This is necessary to ensure that routing is done through cell modem rather
# than wifi radio. 
# Presumes that 'ip monitor route' is running, with output
# to /opt/hotspot/logs/routeChanges.out

tail -f /opt/hotspot/logs/routeChanges.out | while read line;do
   echo "route table change: $line"
   if  [[ $line == "default via"*"eth0" ]]
   then
     echo "remove default eth0 route"
     route del default eth0
   fi
done

