Re: interface flag, lease expire
Roy Marples
Tue Jul 23 13:39:20 2019
On 23/07/2019 14:25, Matěj Grégr wrote:
2) Is it possible to find out somewhere when a lease will expire? dhcpcd
-U doesn't list this information and I am puzzled where to find it.
# This command works fine on NetBSD
$ date -d @$(($(stat -f %m /var/db/dhcpcd/$interface.lease) + $(dhcpcd
-U4 $interface | sed -ne 's/dhcp_lease_time=\(.*\)/\1/p')))
Or basically take the lease file's modification time as when the lease
was assgined and add the duration of the lease to it.
Thanks for the hint. Linux use slightly different syntax (e.g. stat -c
%Y), but that doesn't matter. With your latest patches it's also
possible to obtain the information from valid timer using ip command.
Only Linux has IPv4 address lifetimes, so my hint is still valid for the
other supported OS's.
Glad it works for you though!
Roy
Archive administrator: postmaster@marples.name