Sorry...
...
Here is some pseudocode...
That's just an outline showing the logic you could use to create a script to do what you want.
Problems I know about:
- I don't know if bash has a "while" loop
- I doubt that the ping commands I gave would work as written (you'd at least need an argument to limit the number of ping requests that get sent)
- the bash 'if', 'else', 'endif' structure does not work as I have shown it (so all if/else/endif structures need rewriting)
Things that I know would work:
sleep 30 (do nothing for 30 seconds)
$(config getprop GatewayIP) (returns the current value of GatewayIP -- test using
echo $(config get GatewayIP))
config set GatewayIP 10.0.0.253; signal-event remoteaccess-update (should work; you should test this manually before sitting down to write and debug the rest of the script)
There is lots of actual coding you still need to do.
For example, after googling 'bash if' and reading the results, I can verify that this command successfully compares my current gateway and returns 'yes' for a match and 'no' for a non-match. Replace '192.168.200.1' with your gateway, then expand the 'echo yes' and 'echo no' commands to do what you want depending on if the gateway matches.
if [ $(config get GatewayIP) = 192.168.200.1 ];then echo yes; else echo no; fi