Release dhcp client when rx rate = —-

Good Night
I need a script to automaticlly
Release dhcp client when rx rate = —-
And wan is connected
Thank

:if ( [/ping 8.8.8.8 interface= “ETHERT 1” count=6 ] = 0) do={/ip dhcp-client release numbers=0}

ETHERT 1 is my WAN