What's new

Custom DDNS Script. What am I doing Wrong?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Tanner Harman

Occasional Visitor
This is the error I'm receiving on the main screen.
Main Screen.PNG


This is the DDNS Page
DDNS Screen.PNG
This is the Exact Script with the exception of the Username, Password, and Hostname. I can't seem to get it to work. Any tips would be appreciated. Password and Username are correct. I'm trying to setup an external IP Check to No-Ip so that I can use a certain DNS Provider with a Dynamic IP Address.

Family-Guard@RT-AC68U-D058:/tmp/home/root# vi /jffs/scripts/ddns-start

#No-IP User account info
:local noipuser "Username"
:local noippass "Password"
:local noiphost "Hostname"
:local inetinterface "$IP"

# No more changes need

:local previousIP

if ( [:len [/file find name=("no-ip_ddns_previousip.txt")]] > 0 ) do={
:set previousIP [/file get ("no-ip_ddns_previousip.txt") contents]
}


:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interface
:local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

# Strip the net mask off the IP address
:for i from=( [:len $currentIP] - 1) to=0 do={
:if ( [:pick $currentIP $i] = "/") do={
:set currentIP [:pick $currentIP 0 $i]
}
}

:if ($currentIP != $previousIP) do={
:log info "No-IP: Current IP ($currentIP) is not equal to previous IP ($previousIP), update neede

# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special char
:local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
:local noiphostarray
:set noiphostarray [:toarray $noiphost]
:foreach host in=$noiphostarray do={
:log info "No-IP: Sending update for $host"
/tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=(
:log info "No-IP: Host $host updated on No-IP with IP $currentIP"
/file print file=("no-ip_ddns_previousip.txt")
:delay 3
/file set contents="$currentIP" ("no-ip_ddns_previousip.txt")
}
} else={
:log info "No-IP: Previous IP $previousIP is equal to current IP, no update needed"
}
} else={
:log info "No-IP: $inetinterface is not currently running, so therefore will not update."
}

~
~
- /jffs/scripts/ddns-start 1/49 2%
 
Last edited:
Your script must report back to the firmware whether the DDNS update successfully completed or not. See the Wiki instructions.
 
Your script must report back to the firmware whether the DDNS update successfully completed or not. See the Wiki instructions.


So adding this on the end should do the trick?


if [[ ${RESULT:0:4} == 'good' ]]
then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi
 
So adding this on the end should do the trick?


if [[ ${RESULT:0:4} == 'good' ]]
then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi

Should at least solve the webui reporting a failure to update the DDNS, as it relies on a flag to determine the DDNS state. This will update that flag.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top