Executing a script when DHCPD give an IP
You can find the answer here:
- http://ubuntuforums.org/showthread.php?t=1328967
Here's the copy-paste from the above link:
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac));
execute("/usr/sbin/my_script_here", "commit", ClientIP, ClientMac);
}
It might be different for different versions of Linux, but should give you the idea.
See here for another example:
- https://lists.isc.org/pipermail/dhcp-users/2008-September/007167.html
man dhcpd.conf
should also give you more information.
Baiscally, you want to use on commit
and execute
inside it to specify a script to be run.