When triggers those scripts to run? I removed a static entry from lease. Re-added and host bounded , received IP and still the scripts under /dhcp-server lease-script didn't run
[admin@Mike[1]] /user ssh-keys private> /ip dhcp-server print detail
Flags: D - dynamic, X - disabled, I - invalid
0 name="USER_LAN" interface=USER lease-time=10m address-pool=static-only bootp-support=dynamic bootp-lease-time=forever authoritative=after-2sec-delay use-radius=no
lease-script=:foreach i in=[/ip dhcp-server lease find where server="USER_LAN"] do={ \\r\n:local ip [/ip dhcp-server lease get value-name=address $i]; \\r\n:local hostname [/ip dhcp-server lease get value-name=comment $i];
\\r\n:system ssh user=konrad address=10.0.1.1 \\r\ncommand="check=\$(sudo pdnsutil list-zone hw.sonic 2> /dev/null | grep ^$hostname | awk '{print \$5}'); \r\nif [[ -n \$check ]]; then \\r\nif [ \$check != $ip ]; then echo
\"Replacing with new\" $ip \"IP\"; \\r\nsudo pdnsutil replace-rrset hw.sonic $hostname A 60 $ip > /dev/null 2>&1; \\r\nelse echo $hostname \"already exists\"; fi; \\r\nelse echo \"Adding\" $hostname $ip; \\r\nsudo pdnsutil
add-record hw.sonic $hostname A $ip > /dev/null 2>&1; fi"}
from what I see in the manual
Script that will be executed after lease is assigned or de-assigned. Internal "global" variables that can be used in the script:
leaseBound - set to "1" if bound, otherwise set to "0"
leaseServerName - dhcp server name
leaseActMAC - active mac address
leaseActIP - active IP address
lease-hostname - client hostname
lease-options - array of received options
I can modify my script to perform only for that Bound which connects yes ? Rather than make
foreach loop on all entries. But first why the script isn't triggered