detecting whether a reserved lease is being issued for the first time

Simon Hobson dhcp1 at thehobsons.co.uk
Sat Nov 19 09:18:48 UTC 2016


Afif Elghraoui <afif at ghraoui.name> wrote:

> I have an action that I'd like to run the first time the IP address is
> issued. I used an "on commit" statement, but I see that it gets run
> every time the client boots and rebinds its address. Is there a good way
> for the server to detect whether the IP address is issued for the first
> time?

Is this an action that needs to be run exactly once, or can it be run multiple times without causing problems ?

But my main suggestion is to keep track of the action outside of DHCP. So when your on commit handler is called, check to see if you've already run the task and if so, then skip it.

Be aware that, unless it's changed, ISTR that the "on <action>" hooks need to run fast or they will block the server. So ideally your handler should do as little as possible (perhaps write some data to a signalling file ?) and then return - leaving any time consuming tasks to another process.



More information about the dhcp-users mailing list