DHCP Client script problem

Hello,
I’m trying to execute a script when an interface receives a new IP address from ISP.
For the love of Zeus and the rest of the gods, I cannot figure out how to do this.

:log error "---- DHCP CLIENT CHANGE ----"
:if ($bound = 1) do={
    :log error "Address bound"
    :log error $"lease-address"
    :log error $"gateway-address"
    :log error $"server-address"
}

if ($bound = 0) do={
    :log error "Address unbound"
    :log error "Interface $interface IP lease expired"
}

I have trimmed the part of script that is reused in other places (and works properly).

TL;DR; I want to modify some rules (and update external DNS, and send the IP to my Zulip instance) when new IP is bound, and disable some rules when address is unbound.

I keep getting “executing script from dhcpclient failed, please check it manually”. Wiki isn’t helpful, and there are no examples (that I can find).
Plus, “please check manually” is kind of redundant, as the environment is different when executing the code outside of DHCL client event

Oh-uh.
Apparently /tool/fetch doesn’t work as soon as DHCP client renews the IP. One :delay 10s fixed the problem.

Will probably implement a loop that will ping an external IP on $bound=1, and ditch the 10s delay