There's a couple of posts of mine (and a script) that should give you some ideas in this thread: https://forum.opnsense.org/index.php?topic=5511.0;topicseen
Thanks for the sample script, do you know the command for restarting the WAN with a fixed IP?
ifconfig vmx0 10.0.0.10/24