Patchwork [OpenWrt-Devel] ddns-scripts: Add logging

login
register
Submitter Marius Gedminas
Date 2011-06-08 09:40:21
Message ID <20110608094021.GA7386@platonas>
Download mbox | patch
Permalink /patch/1072/
State New
Headers show

Comments

Marius Gedminas - 2011-06-08 09:40:21
It's useful to have some log output about dynamic DNS updates when
you're trying to debug why they fail.

In my case re-running the script manually with verbosity enabled was not
sufficient (because it succeeded).  A previous update happened on time,
according to the timestamp in /var, and I was sad not to be able to see
the actual output from the failed update request.

Signed-off-by: Marius Gedminas <marius@gedmin.as>



Marius Gedminas

Patch

Index: net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh
===================================================================
--- net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh	(revision 27134)
+++ net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh	(working copy)
@@ -268,6 +268,7 @@  do
 	if [ "$current_ip" != "$registered_ip" ]  || [ $force_interval_seconds -lt $time_since_update ]
 	then
 		verbose_echo "update necessary, performing update ..."
+		logger -t dynamic_dns_updater.sh "$service_id update necessary: current IP = $current_ip, registered IP = $registered_ip"
 
 		#do replacement
 		final_url=$update_url
@@ -294,6 +295,8 @@  do
 		verbose_echo "$update_output"
 		verbose_echo ""
 
+		logger -t dynamic_dns_updater.sh "$service_id update output: $update_output"
+
 		#save the time of the update
 		current_time=$(monotonic_time)
 		last_update=$current_time