Changeset 29977


Ignore:
Timestamp:
2012-01-31T21:00:02+01:00 (6 years ago)
Author:
acinonyx
Message:

[packages] ddns-scripts: Introduce retry_interval option to periodically retry DDNS update, if it fails (#10848)

Location:
packages/net/ddns-scripts/files
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • packages/net/ddns-scripts/files/etc/config/ddns

    r27657 r29977  
    4949# will expire your domain if you don't connect and do an update 
    5050# every so often).  Use the "check_interval" to specify how 
    51 # often to check whether an update is necessary, and the  
    52 # "force_interval" option to specify how often to force an 
    53 # update.  Specify the units for these values with the "check_unit" 
    54 # and the "force_unit" options.  Units can be "days", "hours", 
    55 # "minutes" or "seconds".  The default force_unit is hours and the 
    56 # default check_unit is seconds.  The default check_interval is 
    57 # 600 seconds, or ten minutes.  The default force_interval is  
    58 # 72 hours or 3 days. 
     51# often to check whether an update is necessary, the "retry_interval" 
     52# to specify how often to retry in case the update has failed, and 
     53# the "force_interval" option to specify how often to force an 
     54# update.  Specify the units for these values with the "check_unit", 
     55# the "retry_init" and the "force_unit" options.  Units can be 
     56# "days", "hours", "minutes" or "seconds".  The default force_unit 
     57# is hours, the default retry_unit is seconds and the default 
     58# check_unit is seconds.  The default check_interval is 600 seconds, 
     59# or ten minutes.  The default retry_interval is 60 seconds, or one 
     60# minute. The default force_interval is 72 hours or 3 days. 
    5961# 
    6062# 
     
    7880        option check_interval   "10" 
    7981        option check_unit       "minutes" 
     82        option retry_interval   "60" 
     83        option retry_unit       "seconds" 
    8084 
    8185        #option ip_source       "interface" 
  • packages/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh

    r25578 r29977  
    6767then 
    6868        check_interval=600 
     69fi 
     70 
     71if [ -z "$retry_interval" ] 
     72then 
     73        retry_interval=60 
    6974fi 
    7075 
     
    199204                #default is seconds 
    200205                check_interval_seconds=$check_interval 
     206                ;; 
     207esac 
     208 
     209 
     210 
     211#compute retry interval in seconds 
     212case "$retry_unit" in 
     213        "days" ) 
     214                retry_interval_seconds=$(($retry_interval*60*60*24)) 
     215                ;; 
     216        "hours" ) 
     217                retry_interval_seconds=$(($retry_interval*60*60)) 
     218                ;; 
     219        "minutes" ) 
     220                retry_interval_seconds=$(($retry_interval*60)) 
     221                ;; 
     222        "seconds" ) 
     223                retry_interval_seconds=$retry_interval 
     224                ;; 
     225        * ) 
     226                #default is seconds 
     227                retry_interval_seconds=$retry_interval 
    201228                ;; 
    202229esac 
     
    290317                #here we actually connect, and perform the update 
    291318                update_output=$( $retrieve_prog "$final_url" ) 
     319                if [ $? -gt 0 ] 
     320                then 
     321                        verbose_echo "update failed" 
     322                        sleep $retry_interval_seconds 
     323                        continue 
     324                fi 
    292325 
    293326                verbose_echo "Update Output:" 
Note: See TracChangeset for help on using the changeset viewer.