I was able to get my script working to update my dynamic dns with my dns host! It’s working great.
However I feel like the way I’m calling it through the scheduler is a bit janky. I’m using import file=wanip.rsc to trigger the script running. Is this correct?
Though being a beginner I'm pretty sure you can do the math.
Feel free to share the content of your rsc file to get some proper feedback. Make sure to remove any private info.
Then I upload the wanip.rsc file to the router. Then I open the terminal and run import file=wanip.rsc and get the success message.
How does calling a script from the scheduler work in winbox? If I’m doing it right, that’s fine but it feels like there should be a better, more direct way.
Next time you can use /system script run update_ddns to call it instead of having to save it to a file and use /import. You can put that command in the scheduler for example.
If you use DHCP client for your WAN then you don't need the scheduler script. On the Advanced tab of the DHCP client entry you have the Script section:
Where you can write lease script that allows you to run code whenever DHCP client obtains new IP address lease.
You can use the provided variable $"lease-address" that contains the IP address (don't need to read from the interface anymore) directly. Or if you still want to call your script, then put something like
:if ($bound=1) do={
/system script run update_ddns;
}