Modify

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#13005 closed defect (duplicate)

[PATCH] ddns add support not do force check

Reported by: anonymous Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

If set a value of force_check_interval in /etc/config/ddns configure file, the dynamic_dns_updater.sh will always auto check.

Maybe set the 0 to the force_check_interval, the dynamic_dns_updater.sh only run once is better. Thus the ddns-scripts only run when interface status changed.

When run dynamic_dns_updater.sh manually,if the service id is not a valid section in /etc/config/ddns configure file, the script will exec as follows. maybe move the [ "$enabled" != "1" ] to the front is better.

root@OpenWrt:/usr/lib/ddns# sh dynamic_dns_updater.sh invalid_section_name
update_url=

The patch is:

[kicer@ /work/openwrt]$ cat ddns-scripts-not-force-check.patch 
Index: files/usr/lib/ddns/dynamic_dns_updater.sh
===================================================================
--- files/usr/lib/ddns/dynamic_dns_updater.sh   (revision 35632)
+++ files/usr/lib/ddns/dynamic_dns_updater.sh   (working copy)
@@ -93,9 +93,19 @@
 then
        use_https=0
 fi
-
-
-
+ 
+if [ -z "$enabled" ]
+then
+       enabled=0
+fi
+ 
+#if this service isn't enabled then quit
+if [ "$enabled" != "1" ] 
+then
+       return 0
+fi
+ 
+ 
 #some constants
 
 if [ "x$use_https" = "x1" ]
@@ -154,16 +164,7 @@
 
 
 
-#if this service isn't enabled then quit
-if [ "$enabled" != "1" ] 
-then
-       return 0
-fi
 
-
-
-
-
 #compute update interval in seconds
 case "$force_unit" in
        "days" )
@@ -289,7 +290,7 @@
        verbose_echo "registered domain ip = $registered_ip"
 
 
-       if [ "$current_ip" != "$registered_ip" ]  || [ $force_interval_seconds -lt $time_since_update ]
+       if [ "$current_ip" != "$registered_ip" ]  || [ $force_interval_seconds -ne 0 -a $force_interval_seconds -lt $time_since_update ]
        then
                verbose_echo "update necessary, performing update ..."
 
@@ -343,7 +344,12 @@
        fi
 
        #sleep for 10 minutes, then re-check ip && time since last update
-       sleep $check_interval_seconds
+       if [ $force_interval_seconds -eq 0 ]; then
+               verbose_echo "no force check, just exit"
+               break;
+       else
+               sleep $check_interval_seconds
+       fi
 done
 
 #should never get here since we're a daemon, but I'll throw it in anyway
[kicer@ /work/openwrt]$ cat luci-ddns-not-force-check.patch 
Index: luasrc/model/cbi/ddns/ddns.lua
===================================================================
--- luasrc/model/cbi/ddns/ddns.lua      (revision 9668)
+++ luasrc/model/cbi/ddns/ddns.lua      (working copy)
@@ -122,7 +122,7 @@
 unit:value("hours", translate("h"))
 
 fi = s:option(Value, "force_interval", translate("Force update every"))
-fi.datatype = "and(uinteger,min(1))"
+fi.datatype = "and(uinteger,min(0))"
 fi.default = 72
 
 unit = s:option(ListValue, "force_unit", translate("Force-time unit"))

Attachments (2)

ddns-scripts-not-force-check.patch (1.0 KB) - added by anonymous 5 years ago.
luci-ddns-not-force-check.patch (506 bytes) - added by anonymous 5 years ago.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by anonymous

Changed 5 years ago by anonymous

comment:1 Changed 5 years ago by joykicer@…

very sorry for duplicate submitted, please closed this ticket.

comment:2 Changed 5 years ago by nbd

  • Resolution set to duplicate
  • Status changed from new to closed

comment:3 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.