Tanner Harman
Occasional Visitor
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 ( [ick $currentIP $i] = "/") do={
:set currentIP [ick $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%
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 ( [ick $currentIP $i] = "/") do={
:set currentIP [ick $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: