DDNS terminates at update time

I've had DDNS running for some time updated by my PiHole, however, I want to set up a new one for my mother on an OpenWrt router (old TPLink) I plan to give to her when I visit next month. To make sure I knew what I was doing I have tried to set this up on my current router a Pi running OpenWrt. This runs fine on first setting and I checking the log get the response from the provider, however, when the next check rolls around there's a time out

091500  WARN : Get registered/public IP for 'mydomain.freeddns.org' failed after 5 retries - TERMINATE
091500  WARN : PID '12873' exit WITH ERROR '1' at 2022-03-16 09:15

There's a whole load of prior errors about missing libraries I think to do with no IPV6 as they are there when it works at first run.

my config


config service 'dynu'
        option enabled '1'
        option lookup_host 'mydomain.freeddns.org'
        option use_ipv6 '0'
        option service_name 'dynu.com'
        option domain 'mydomain.freeddns.org'
        option username 'myname'
        option password 'mypassword'
        option use_syslog '2'
        option check_unit 'minutes'
        option force_unit 'minutes'
        option retry_unit 'seconds'
        option ip_source 'network'
        option ip_network 'Wan'
        option interface 'Wan'
        option check_interval '15'
        option retry_count '5'
        option retry_interval '60'
        option force_interval '720'
        option use_https '1'
        option cacert 'IGNORE'
        option force_ipversion '1'

If I check with ifconfig my pppoe-Wan has the correct external IP address and I can successfully update one of my other dynamic addresses with a script on my PiHole and it does update fine on first run.

You can see the detailed logs, at "/var/log/ddns/".

Also, try to execute "nslookup mydomain.freedns.org", and see what happens.

root@Pi-Router:~# nslookup mydomain.freeddns.org
Server:		192.168.70.250
Address:	192.168.70.250#53

Name:      mydomain.freeddns.org
Address 1: 2xx.1xx.2xx.1xx
*** Can't find WDR.freeddns.org: No answer

Returns the IPV4 address correctly, there is no IPV6, ergo the result is similar to other domains I am updating from the PiHole.

The log at /var/log/ddns is the same as the one seen via the log view in luci. This works on first run, I see the response from Dynu in the log of nochg it is only subsequent checks that fail reading the Wan IP.

Although the internal script sees to bin out on check I've written a somewhat crude script which at least on my Pi is running.

hostname="mydomain.freeddns.org"
password="mypassword"

# functions
get_wan () {
ifconfig | grep -A 1 "Wan" | grep inet | awk -v OFS="\n" '{ print $2, $NF }' | grep "addr" | grep -oE "\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
}
get_host () {
nslookup "$hostname" | grep "Address 1"  | grep -oE "\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
}

echo url="https://api.dynu.com/nic/update?hostname=$hostname&password=$password" | curl -k -o -K - 
sleep 60

while :
do
WAN_IP=$(get_wan)
HOST_IP=$(get_host)
if [[  "$WAN_IP" -ne "$HOST_IP" ]]
                then
                echo addresses do not match"
                echo url="https://api.dynu.com/nic/update?hostname=$hostname&password=$password" | curl -k -o -K -
                else
                echo addresses match"
                fi
sleep 900
done

I've put in somewhat more error checks and it resets at midnight and restarts but that's the gist of it.