Hi sdfyjert,
I have been playing around with this and its a good script, I am using 90% of this idea and implementation and its working really well so far; thank you.
There does appear to be a slight issue though as the script as its shown above does not work; at least for me.
Specifically $(avahi-resolve -4 -n inas.local | cut -f 2) does not resolve ("avahi-resolve: not found") when running on the unraid server either in the script or via the terminal. If however I run this on another machine on my network it does work. still looking into why this is. I love this idea of not having to manually specifying the same IP each time but something stuffing it up on my rig.
And yes I do change the inas.local to my own server name; like I said the command works on other machines just not locally on unraid.
Does this script still work on your unraid? I am running 6.12.4.