Have a look at /etc/dhcp/dhclient-exit-hooks. The only thing is, when I tried using it in a very basic way, it triggered every time
the lease was renewed. There may be options only to trigger on IP change. I stopped looking at that point as my "dynamic IP" is
virtually static and has not changed in over a year now.

I had similar issues with dhclient hooks for my Philips Hue lights :)

When I'm coming home, and my phone joins the wifi, and it is dark and
the lights are off, turn on the lights. However, that also resulted in
the lights turning on in the middle of night on a DHCP lease renewal.

I've just had a look at man dhclient-script and part of it says:

Operation

When dhclient needs to invoke the client configuration script, it defines a set of variables in the environment, and then invokes /sbin/dhclient-script. In all cases, $reason is set to the name of the reason why the script has been invoked. The following reasons are currently defined: MEDIUM, PREINIT, BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL, STOP, RELEASE, NBI and TIMEOUT.
so perhaps intelligent querying of $reason may yield results

Nick
_______________________________________________
Swan mailing list
[email protected]
https://lists.libreswan.org/mailman/listinfo/swan

Reply via email to