feature: periodically re-converge records

feature: periodically re-converge records

If the environment variable DDNSSD_CHECKPOINT_SECONDS contains a positive integer value, then the service will reconcile the expected v. existing records on that schedule.

diff --git a/README.md b/README.md
index aec5abb..abe8c0c 100644
--- a/README.md
+++ b/README.md
@@ -200,6 +200,14 @@ sensible default which works OK in at least some circumstances.
     an exposed port in the container. Otherwise a warning will be logged,
     but the service instance will be registered.
 
+* **`DDNSSD_CHECKPOINT_SECONDS`**
+
+    *Default*: `0`
+
+    If set to a positive integer value, then the service will reconcile the
+    expected v. existing records on that schedule. Otherwise it only happens
+    when the service is first started.
+
 Each DNS service plugin may also have its own configuration variables that
 can be used to configure backend-specific items; see the description of your
 chosen service backend under "Support DNS Services", below, for more
diff --git a/bin/ddns-sd b/bin/ddns-sd
index 2a2fd8c..134b1ef 100755
--- a/bin/ddns-sd
+++ b/bin/ddns-sd
@@ -71,6 +71,18 @@ begin
     end
   end
 
+  if ENV['DDNSSD_CHECKPOINT_SECONDS']
+    interval = ENV['DDNSSD_CHECKPOINT_SECONDS'].to_i
+    if interval > 0
+      Thread.new do
+        loop do
+          sleep interval
+          sig_w.print 'C'
+        end
+      end
+    end
+  end
+
   system.run
 rescue DDNSSD::Config::InvalidEnvironmentError => ex
   $stderr.puts "F Invalid configuration: #{ex.message}"

GitHub sha: cf343f77