According to this answer, DHCPd lease files are cleared every hour. The goal is to back up the leases file continuously, so there is never a lease lost. This is made difficult since it is unclear whether the hour timer is based on system time (eg the file is rewritten at 1am, 2am, 3am etc) or process time (service_start + 1h, service_start + 2h, etc). Say the leases file is cleared at exactly 3am, and a lease is granted at 2:58:55; the service that backs up the lease file would need to run, quickly, before the file is cleaned.
The DHCPd process makes its own backup of the file to /var/lib/dhcpd/dhcpd.leases~
. The best bet then seems to be to make a script that backs up this file to another location every hour. But if the DHCPd process is restarted and the timer is relative to the process, it would be possible for the hour mark on the backup tasks to align, which might end in one process reading while the other writes, and that could mangle the file (depending on how it's done). So the backup task would need some knowledge of when DHCPd starts. This is getting complicated.
What is the 'correct' way to back up the DHCPd leases file, so no leases are lost?