Browse Source

ddns-scripts: Update to version 2.1.0-3

- removed special handling for dynamic_dns_helper.sh and url_escape.sed in Makefile/postinst
- minor fixes in logging
- allow retry_count of "0" to run infinite retrys on error
	-- https://dev.openwrt.org/ticket/18382
- changed naming of .dat and .err file to have one per section, not one per process
- defer hotplug helper from 25-ddns to 95-ddns (according initscript START=95)
	-- https://github.com/openwrt/packages/issues/568 (#568)
- fix commandline for busybox wget
	-- https://dev.openwrt.org/ticket/18411
	-- https://dev.openwrt.org/ticket/18437
	-- https://github.com/openwrt/packages/issues/605 (#605)
- remove checking answer from ddns provider because there are to many different.
	Some providers do not follow API from dyndns.com

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Christian Schoenebeck 10 years ago
parent
commit
5e8123eb3b

+ 24
- 5
net/ddns-scripts/CHANGELOG View File

@@ -1,20 +1,39 @@
1
+Version 2.1.0-3
2
+Date	2014-12-07
3
+
4
+- removed special handling for dynamic_dns_helper.sh and url_escape.sed in Makefile/postinst
5
+- minor fixes in logging
6
+- allow retry_count of "0" to run infinite retrys on error
7
+	-- https://dev.openwrt.org/ticket/18382
8
+- changed naming of .dat and .err file to have one per section, not one per process
9
+- defer hotplug helper from 25-ddns to 95-ddns (according initscript START=95) 
10
+	-- https://github.com/openwrt/packages/issues/568 (#568)
11
+- fix commandline for busybox wget
12
+	-- https://dev.openwrt.org/ticket/18411
13
+	-- https://dev.openwrt.org/ticket/18437
14
+	-- https://github.com/openwrt/packages/issues/605 (#605)
15
+- remove checking answer from ddns provider because there are to many different. 
16
+Many providers did not follow API from dyndns.com 
17
+
18
+--------------------------------------------------------------------------------
1 19
 Version 2.1.0-2
2 20
 Date	2014-11-15
3 21
 
4 22
 - moved /usr/lib/ddns/dynamic_dns_lucihelper.sh from luci-app-ddns into this package
5
-	(Github openwrt/luci issue 251)
6
-	(OpenWrt Trac tickets 18326 18347)
23
+	-- https://github.com/openwrt/luci/issue/251
24
+	-- https://dev.openwrt.org/ticket/18326
25
+	-- https://dev.openwrt.org/ticket/18347
7 26
 - fix: dynamic_dns_update.sh did not loop
8
-	(OpenWrt Trac ticket 18336)
27
+	-- https://dev.openwrt.org/ticket/18336
9 28
 - add provider cloudflare.com IPv4 and IPv6 (Thanks to Paul for support and testing)
10
-	(OpenWrt Trac ticket 12500)
29
+	-- https://dev.openwrt.org/ticket/12500
11 30
 - modified detection, if dynamic_dns_fuctions are used by dynamic_dns_lucihelper.sh
12 31
 - redirect stdout of wget,curl,host,nslookup,nc etc to /tmp/ddns_$$.dat and *.err instead of variables
13 32
 - extended error detection in get_local_ip function
14 33
 - modified verify of option ip_script to allow parameters, when calling
15 34
 - add provider selfhost.de IPv4
16 35
 - add provider no-ip.pl (nothing to do with no-ip.com)
17
-	(Github openwrt/packages issue #542)
36
+	-- https://github.com/openwrt/packages/issues/542 (#542)
18 37
 	IPv4 (tested) and also added for
19 38
 	IPv6 (NOT tested) because client IP is autodetected be provider
20 39
 - add getlocalip_sample.sh as sample script for usage of

+ 3
- 11
net/ddns-scripts/Makefile View File

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
2 2
 
3 3
 PKG_NAME:=ddns-scripts
4 4
 PKG_VERSION:=2.1.0
5
-PKG_RELEASE:=2
5
+PKG_RELEASE:=3
6 6
 PKG_LICENSE:=GPL-2.0
7 7
 
8 8
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
@@ -19,8 +19,7 @@ define Package/ddns-scripts
19 19
 endef
20 20
 
21 21
 define Package/ddns-scripts/description
22
-	A highly configurable set of scripts for doing dynamic dns updates.
23
-	NEW in this version:
22
+A highly configurable set of scripts for doing dynamic dns updates.
24 23
 	- IPv6 support
25 24
 	- force communication to IPv4 or IPv6 only
26 25
 	- DNS server support
@@ -29,6 +28,7 @@ define Package/ddns-scripts/description
29 28
 	- Proxy server support
30 29
 	- log file support
31 30
 	- support to run once
31
+Version: $(PKG_VERSION)-$(PKG_RELEASE)
32 32
 endef
33 33
 
34 34
 define Build/Prepare
@@ -64,14 +64,6 @@ define Package/ddns-scripts/postinst
64 64
 	# if run within buildroot exit
65 65
 	[ -n "$${IPKG_INSTROOT}" ] && exit 0
66 66
 
67
-	# remove old sed script file
68
-	[ -f /usr/lib/ddns/url_escape.sed ] && rm -f /usr/lib/ddns/url_escape.sed
69
-
70
-	# luci updates are not in sync with ddns-script updates !!!
71
-	# if old luci-app-ddns then errors during install because exist from differnt package
72
-	# copy dynamic_dns_helper.tmp.sh -> dynamic_dns_helper.sh
73
-	cp -f /usr/lib/ddns/dynamic_dns_lucihelper.tmp.sh /usr/lib/ddns/dynamic_dns_lucihelper.sh
74
-
75 67
 	# add new section "ddns" "global" if not exists
76 68
 	uci -q get ddns.global > /dev/null || uci -q set ddns.global='ddns'
77 69
 	uci -q get ddns.global.date_format > /dev/null || uci -q set ddns.global.date_format='%F %R'

net/ddns-scripts/files/etc/hotplug.d/iface/25-ddns → net/ddns-scripts/files/etc/hotplug.d/iface/95-ddns View File


+ 34
- 31
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh View File

@@ -34,13 +34,15 @@ VERBOSE_MODE=1		# default mode is log to console, but easily changed with parame
34 34
 
35 35
 # directory to store run information to.
36 36
 RUNDIR=$(uci -q get ddns.global.run_dir) || RUNDIR="/var/run/ddns"
37
+[ -d $RUNDIR ] || mkdir -p -m755 $RUNDIR
37 38
 # NEW # directory to store log files
38 39
 LOGDIR=$(uci -q get ddns.global.log_dir) || LOGDIR="/var/log/ddns"
40
+[ -d $LOGDIR ] || mkdir -p -m755 $LOGDIR
39 41
 LOGFILE=""		# NEW # logfile can be enabled as new option
40 42
 PIDFILE=""		# pid file
41 43
 UPDFILE=""		# store UPTIME of last update
42
-DATFILE="/tmp/ddns_$$.dat"	# save stdout data of WGet and other extern programs called
43
-ERRFILE="/tmp/ddns_$$.err"	# save stderr output of WGet and other extern programs called
44
+DATFILE=""		# save stdout data of WGet and other extern programs called
45
+ERRFILE=""		# save stderr output of WGet and other extern programs called
44 46
 
45 47
 # number of lines to before rotate logfile
46 48
 LOGLINES=$(uci -q get ddns.global.log_lines) || LOGLINES=250
@@ -224,7 +226,6 @@ write_log() {
224 226
 	[ $VERBOSE_MODE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG"
225 227
 	# write to logfile
226 228
 	if [ ${use_logfile:-1} -eq 1 -o $VERBOSE_MODE -gt 1 ]; then
227
-		[ -d $LOGDIR ] || mkdir -p -m 755 $LOGDIR
228 229
 		echo -e "$__MSG" >> $LOGFILE
229 230
 		# VERBOSE_MODE > 1 then NO loop so NO truncate log to $LOGLINES lines
230 231
 		[ $VERBOSE_MODE -gt 1 ] || sed -i -e :a -e '$q;N;'$LOGLINES',$D;ba' $LOGFILE
@@ -302,8 +303,7 @@ get_service_data() {
302 303
 		awk ' gsub("\x27", "\"") { if ($1~/^[^\"]*$/) $1="\""$1"\"" }; { if ( $NF~/^[^\"]*$/) $NF="\""$NF"\""  }; { print $0 }')
303 304
 
304 305
 	IFS=$__NEWLINE_IFS
305
-	for __LINE in $__SERVICES
306
-	do
306
+	for __LINE in $__SERVICES; do
307 307
 		#grep out proper parts of data and use echo to remove quotes
308 308
 		__NAME=$(echo $__LINE | grep -o "^[\t ]*\"[^\"]*\"" | xargs -r -n1 echo)
309 309
 		__DATA=$(echo $__LINE | grep -o "\"[^\"]*\"[\t ]*$" | xargs -r -n1 echo)
@@ -459,7 +459,7 @@ verify_host_port() {
459 459
 	# command error
460 460
 	[ $__ERR -gt 0 ] && {
461 461
 		write_log 3 "DNS Resolver Error - BusyBox nslookup Error '$__ERR'"
462
-		write_log 7 "Error:\n$(cat $ERRFILE)"
462
+		write_log 7 "$(cat $ERRFILE)"
463 463
 		return 2
464 464
 	}
465 465
 	# extract IP address
@@ -499,7 +499,7 @@ verify_host_port() {
499 499
 		__ERR=$?
500 500
 		[ $__ERR -eq 0 ] && return 0
501 501
 		write_log 3 "Connect error - BusyBox nc (netcat) Error '$__ERR'"
502
-		write_log 7 "Error:\n$(cat $ERRFILE)"
502
+		write_log 7 "$(cat $ERRFILE)"
503 503
 		return 3
504 504
 	else		# nc compiled without extensions (no timeout support)
505 505
 		__RUNPROG="timeout 2 -- /usr/bin/nc $__IP $__PORT </dev/null >$DATFILE 2>$ERRFILE"
@@ -533,7 +533,7 @@ verify_dns() {
533 533
 		elif [ $__ERR -ne 0 ]; then
534 534
 			__CNT=$(( $__CNT + 1 ))	# increment error counter
535 535
 			# if error count > retry_count leave here
536
-			[ $__CNT -gt $retry_count ] && \
536
+			[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
537 537
 				write_log 14 "Verify DNS server '$1' failed after $retry_count retries"
538 538
 
539 539
 			write_log 4 "Verify DNS server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
@@ -593,7 +593,7 @@ verify_proxy() {
593 593
 		elif [ $__ERR -gt 0 ]; then
594 594
 			__CNT=$(( $__CNT + 1 ))	# increment error counter
595 595
 			# if error count > retry_count leave here
596
-			[ $__CNT -gt $retry_count ] && \
596
+			[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
597 597
 				write_log 14 "Verify Proxy server '$1' failed after $retry_count retries"
598 598
 
599 599
 			write_log 4 "Verify Proxy server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
@@ -637,7 +637,7 @@ do_transfer() {
637 637
 		# disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set)
638 638
 		[ -z "$proxy" ] && __PROG="$__PROG --no-proxy"
639 639
 
640
-		__RUNPROG="$__PROG $__URL"	# build final command
640
+		__RUNPROG="$__PROG '$__URL'"	# build final command
641 641
 		__PROG="GNU Wget"		# reuse for error logging
642 642
 
643 643
 	# 2nd choice is cURL IPv4/IPv6/HTTPS
@@ -671,7 +671,7 @@ do_transfer() {
671 671
 				write_log 13 "cURL: libcurl compiled without Proxy support"
672 672
 		fi
673 673
 
674
-		__RUNPROG="$__PROG $__URL"	# build final command
674
+		__RUNPROG="$__PROG '$__URL'"	# build final command
675 675
 		__PROG="cURL"			# reuse for error logging
676 676
 
677 677
 	# busybox Wget (did not support neither IPv6 nor HTTPS)
@@ -686,8 +686,8 @@ do_transfer() {
686 686
 		# disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set)
687 687
 		[ -z "$proxy" ] && __PROG="$__PROG -Y off"
688 688
 
689
-		__RUNPROG="$__PROG $__URL 2>$ERRFILE"	# build final command
690
-		__PROG="Busybox Wget"			# reuse for error logging
689
+		__RUNPROG="$__PROG '$__URL' 2>$ERRFILE"		# build final command
690
+		__PROG="Busybox Wget"				# reuse for error logging
691 691
 
692 692
 	else
693 693
 		write_log 13 "Neither 'Wget' nor 'cURL' installed or executable"
@@ -695,7 +695,7 @@ do_transfer() {
695 695
 
696 696
 	while : ; do
697 697
 		write_log 7 "#> $__RUNPROG"
698
-		$__RUNPROG			# DO transfer
698
+		eval $__RUNPROG			# DO transfer
699 699
 		__ERR=$?			# save error code
700 700
 		[ $__ERR -eq 0 ] && return 0	# no error leave
701 701
 		[ $LUCI_HELPER ] && return 1	# no retry if called by LuCI helper script
@@ -711,7 +711,7 @@ do_transfer() {
711 711
 
712 712
 		__CNT=$(( $__CNT + 1 ))	# increment error counter
713 713
 		# if error count > retry_count leave here
714
-		[ $__CNT -gt $retry_count ] && \
714
+		[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
715 715
 			write_log 14 "Transfer failed after $retry_count retries"
716 716
 
717 717
 		write_log 4 "Transfer failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
@@ -750,11 +750,11 @@ send_update() {
750 750
 
751 751
 		write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"
752 752
 
753
-		# analyse provider answers
754
-		# "good [IP_ADR]"	= successful
755
-		# "nochg [IP_ADR]"	= no change but OK
756
-		grep -E "good|nochg" $DATFILE >/dev/null 2>&1
757
-		return $?	# "0" if "good" or "nochg" found
753
+		return 0
754
+		# TODO analyse providers answer
755
+		# "good" or "nochg"		= dyndns.com compatible API
756
+		# grep -i -E "good|nochg" $DATFILE >/dev/null 2>&1
757
+		# return $?	# "0" if found
758 758
 	fi
759 759
 }
760 760
 
@@ -846,6 +846,9 @@ get_local_ip () {
846 846
 		}
847 847
 
848 848
 		[ $LUCI_HELPER ] && return 1	# no retry if called by LuCI helper script
849
+
850
+		write_log 7 "Data detected:\n$(cat $DATFILE)"
851
+
849 852
 		[ $VERBOSE_MODE -gt 1 ] && {
850 853
 			# VERBOSE_MODE > 1 then NO retry
851 854
 			write_log 4 "Get local IP via '$ip_source' failed - Verbose Mode: $VERBOSE_MODE - NO retry on error"
@@ -854,9 +857,8 @@ get_local_ip () {
854 857
 
855 858
 		__CNT=$(( $__CNT + 1 ))	# increment error counter
856 859
 		# if error count > retry_count leave here
857
-		[ $__CNT -gt $retry_count ] && \
860
+		[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
858 861
 			write_log 14 "Get local IP via '$ip_source' failed after $retry_count retries"
859
-
860 862
 		write_log 4 "Get local IP via '$ip_source' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
861 863
 		sleep $RETRY_SECONDS &
862 864
 		PID_SLEEP=$!
@@ -908,7 +910,7 @@ get_registered_ip() {
908 910
 		__ERR=$?
909 911
 		if [ $__ERR -ne 0 ]; then
910 912
 			write_log 3 "$__PROG error: '$__ERR'"
911
-			write_log 7 "Error:\n$(cat $ERRFILE)"
913
+			write_log 7 "$(cat $ERRFILE)"
912 914
 		else
913 915
 			if [ "$__PROG" = "BIND host" ]; then
914 916
 				__DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' )
@@ -934,7 +936,7 @@ get_registered_ip() {
934 936
 
935 937
 		__CNT=$(( $__CNT + 1 ))	# increment error counter
936 938
 		# if error count > retry_count leave here
937
-		[ $__CNT -gt $retry_count ] && \
939
+		[ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
938 940
 			write_log 14 "Get registered/public IP for '$domain' failed after $retry_count retries"
939 941
 
940 942
 		write_log 4 "Get registered/public IP for '$domain' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
@@ -966,18 +968,19 @@ trap_handler() {
966 968
 	[ $PID_SLEEP -ne 0 ] && kill -$1 $PID_SLEEP 2>/dev/null	# kill pending sleep if exist
967 969
 
968 970
 	case $1 in
969
-		0)	if [ $__ERR -eq 0 ]; then
971
+		 0)	if [ $__ERR -eq 0 ]; then
970 972
 				write_log 5 "PID '$$' exit normal at $(eval $DATE_PROG)\n"
971 973
 			else
972 974
 				write_log 4 "PID '$$' exit WITH ERROR '$__ERR' at $(eval $DATE_PROG)\n"
973 975
 			fi ;;
974
-		1)	write_log 6 "PID '$$' received 'SIGHUP' at $(eval $DATE_PROG)"
975
-			eval "$0 $SECTION_ID $VERBOSE_MODE &"	# reload config via restarting script
976
-			exit 0 ;;
977
-		2)	write_log 5 "PID '$$' terminated by 'SIGINT' at $(eval $DATE_PROG)\n";;
978
-		3)	write_log 5 "PID '$$' terminated by 'SIGQUIT' at $(eval $DATE_PROG)\n";;
976
+		 1)	write_log 6 "PID '$$' received 'SIGHUP' at $(eval $DATE_PROG)"
977
+			# reload config via starting the script again 
978
+			eval "/usr/lib/ddns/dynamic_dns_updater.sh $SECTION_ID $VERBOSE_MODE &"
979
+			exit 0 ;;	# and leave this one
980
+		 2)	write_log 5 "PID '$$' terminated by 'SIGINT' at $(eval $DATE_PROG)\n";;
981
+		 3)	write_log 5 "PID '$$' terminated by 'SIGQUIT' at $(eval $DATE_PROG)\n";;
979 982
 		15)	write_log 5 "PID '$$' terminated by 'SIGTERM' at $(eval $DATE_PROG)\n";;
980
-		*)	write_log 13 "Unhandled signal '$1' in 'trap_handler()'";;
983
+		 *)	write_log 13 "Unhandled signal '$1' in 'trap_handler()'";;
981 984
 	esac
982 985
 
983 986
 	__PIDS=$(pgrep -P $$)	# get my childs (pgrep prints with "newline")

net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_lucihelper.tmp.sh → net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_lucihelper.sh View File

@@ -22,6 +22,8 @@
22 22
 # preset some variables, wrong or not set in dynamic_dns_functions.sh
23 23
 SECTION_ID="lucihelper"
24 24
 LOGFILE="$LOGDIR/$SECTION_ID.log"
25
+DATFILE="$RUNDIR/$SECTION_ID.dat"	# save stdout data of WGet and other extern programs called
26
+ERRFILE="$RUNDIR/$SECTION_ID.err"	# save stderr output of WGet and other extern programs called
25 27
 VERBOSE_MODE=0		# no console logging
26 28
 # global variables normally set by reading DDNS UCI configuration
27 29
 use_syslog=0		# no syslog

+ 18
- 22
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh View File

@@ -44,6 +44,8 @@ VERBOSE_MODE=${2:-1}	# default mode is log to console
44 44
 # set file names
45 45
 PIDFILE="$RUNDIR/$SECTION_ID.pid"	# Process ID file
46 46
 UPDFILE="$RUNDIR/$SECTION_ID.update"	# last update successful send (system uptime)
47
+DATFILE="$RUNDIR/$SECTION_ID.dat"	# save stdout data of WGet and other extern programs called
48
+ERRFILE="$RUNDIR/$SECTION_ID.err"	# save stderr output of WGet and other extern programs called
47 49
 LOGFILE="$LOGDIR/$SECTION_ID.log"	# log file
48 50
 
49 51
 # VERBOSE_MODE > 1 delete logfile if exist to create an empty one
@@ -98,14 +100,14 @@ trap "trap_handler 15" 15	# SIGTERM	Termination
98 100
 #
99 101
 # retry_interval	if error was detected retry in
100 102
 # retry_unit		'days' 'hours' 'minutes' 'seconds'
101
-# retry_count 		#NEW# number of retries before scripts stops
103
+# retry_count 		number of retries before scripts stops
102 104
 #
103
-# use_ipv6		#NEW# detecting/sending IPv6 address
104
-# force_ipversion	#NEW# force usage of IPv4 or IPv6 for the whole detection and update communication
105
-# dns_server		#NEW# using a non default dns server to get Registered IP from Internet
106
-# force_dnstcp		#NEW# force communication with DNS server via TCP instead of default UDP
107
-# proxy			#NEW# using a proxy for communication !!! ALSO used to detect local IP via web => return proxy's IP !!!
108
-# use_logfile		#NEW# self-explanatory "/var/log/ddns/$SECTION_ID.log"
105
+# use_ipv6		detecting/sending IPv6 address
106
+# force_ipversion	force usage of IPv4 or IPv6 for the whole detection and update communication
107
+# dns_server		using a non default dns server to get Registered IP from Internet
108
+# force_dnstcp		force communication with DNS server via TCP instead of default UDP
109
+# proxy			using a proxy for communication !!! ALSO used to detect local IP via web => return proxy's IP !!!
110
+# use_logfile		self-explanatory "/var/log/ddns/$SECTION_ID.log"
109 111
 #
110 112
 # some functionality needs
111 113
 # - GNU Wget or cURL installed for sending updates to DDNS service
@@ -138,12 +140,12 @@ esac
138 140
 # set defaults if not defined
139 141
 [ -z "$enabled" ]	  && enabled=0
140 142
 [ -z "$retry_count" ]	  && retry_count=5
141
-[ -z "$use_syslog" ]      && use_syslog=0	# not use syslog
143
+[ -z "$use_syslog" ]      && use_syslog=2	# syslog "Notice"
142 144
 [ -z "$use_https" ]       && use_https=0	# not use https
143
-[ -z "$use_logfile" ]     && use_logfile=1	# NEW - use logfile by default
144
-[ -z "$use_ipv6" ]	  && use_ipv6=0		# NEW - use IPv4 by default
145
-[ -z "$force_ipversion" ] && force_ipversion=0	# NEW - default let system decide
146
-[ -z "$force_dnstcp" ]	  && force_dnstcp=0	# NEW - default UDP
145
+[ -z "$use_logfile" ]     && use_logfile=1	# use logfile by default
146
+[ -z "$use_ipv6" ]	  && use_ipv6=0		# use IPv4 by default
147
+[ -z "$force_ipversion" ] && force_ipversion=0	# default let system decide
148
+[ -z "$force_dnstcp" ]	  && force_dnstcp=0	# default UDP
147 149
 [ -z "$ip_source" ]	  && ip_source="network"
148 150
 [ "$ip_source" = "network" -a -z "$ip_network" -a $use_ipv6 -eq 0 ] && ip_network="wan"  # IPv4: default wan
149 151
 [ "$ip_source" = "network" -a -z "$ip_network" -a $use_ipv6 -eq 1 ] && ip_network="wan6" # IPv6: default wan6
@@ -185,15 +187,8 @@ write_log 7 "retry counter : $retry_count times"
185 187
 [ -n "$update_script" -a ! -f "$update_script" ] && write_log 14 "Custom update_script not found!"
186 188
 
187 189
 #kill old process if it exists & set new pid file
188
-if [ -d $RUNDIR ]; then
189
-	#if process for section is already running, stop it
190
-	stop_section_processes "$SECTION_ID"
191
-	[ $? -gt 0 ] && write_log 7 "Send 'SIGTERM' to old process" || write_log 7 "No old process"
192
-else
193
-	#make dir since it doesn't exist
194
-	mkdir -p $RUNDIR
195
-	write_log 7 "No old process"
196
-fi
190
+stop_section_processes "$SECTION_ID"
191
+[ $? -gt 0 ] && write_log 7 "Send 'SIGTERM' to old process" || write_log 7 "No old process"
197 192
 echo $$ > $PIDFILE
198 193
 
199 194
 # determine when the last update was
@@ -307,7 +302,8 @@ while : ; do
307 302
 	if [ "$LOCAL_IP" != "$REGISTERED_IP" ]; then
308 303
 		if [ $VERBOSE_MODE -le 1 ]; then	# VERBOSE_MODE <=1 then retry
309 304
 			ERR_UPDATE=$(( $ERR_UPDATE + 1 ))
310
-			[ $ERR_UPDATE -gt $retry_count ] && write_log 14 "Updating IP at DDNS provider failed after $retry_count retries"
305
+			[ $retry_count -gt 0 -a $ERR_UPDATE -gt $retry_count ] && \
306
+				write_log 14 "Updating IP at DDNS provider failed after $retry_count retries"
311 307
 			write_log 4 "Updating IP at DDNS provider failed - starting retry $ERR_UPDATE/$retry_count"
312 308
 			continue # loop to beginning
313 309
 		else

+ 5
- 0
net/ddns-scripts/files/usr/lib/ddns/getlocalip_sample.sh View File

@@ -10,6 +10,11 @@
10 10
 #
11 11
 # the script is executed (not parsed) inside get_local_ip() function
12 12
 # of /usr/lib/ddns/dynamic_dns_functions.sh
13
+# 
14
+# useful when this box is the only DDNS client in the network
15
+# IP adresses of "internal" boxes could be detected with this script
16
+# so no need to install ddns client on every "internal" box
17
+# On IPv6 every internal box normally has it's own external IP
13 18
 #
14 19
 # This script should
15 20
 # 	- return the IP address via stdout	echo -n "...."	!!! without line feed