2 # script for sending updates to no-ip.com / noip.com
3 # 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
5 # This script is parsed by dynamic_dns_functions.sh inside send_update() function
7 # provider did not reactivate records, if no IP change was recognized
8 # so we send a dummy (localhost) and a seconds later we send the correct IP addr
11 local __UPDURL
="http://[USERNAME]:[PASSWORD]@dynupdate.no-ip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
13 # set IP version dependend dummy (localhost)
14 [ $use_ipv6 -eq 0 ] && __LH
="127.0.0.1" || __LH
="::1"
16 # lets do DUMMY transfer
17 write_log
7 "sending dummy IP to 'no-ip.com'"
18 __URL
=$
(echo $__UPDURL |
sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
19 -e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__LH#g")
20 [ $use_https -ne 0 ] && __URL
=$
(echo $__URL |
sed -e 's#^http:#https:#')
22 do_transfer __ANSWER
"$__URL" ||
return 1
24 write_log
7 "'no-ip.com' answered:\n$__ANSWER"
25 # analyse provider answers
26 # "good [IP_ADR]" = successful
27 # "nochg [IP_ADR]" = no change but OK
28 echo "$__ANSWER" |
grep -E "good|nochg" >/dev
/null
2>&1 ||
return 1
33 # now send the correct data
34 write_log
7 "sending real IP to 'no-ip.com'"
35 __URL
=$
(echo $__UPDURL |
sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
36 -e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
37 [ $use_https -ne 0 ] && __URL
=$
(echo $__URL |
sed -e 's#^http:#https:#')
39 do_transfer __ANSWER
"$__URL" ||
return 1
41 write_log
7 "'no-ip.com' answered:\n$__ANSWER"
42 # analyse provider answers
43 # "good [IP_ADR]" = successful
44 # "nochg [IP_ADR]" = no change but OK
45 echo "$__ANSWER" |
grep -E "good|nochg" >/dev
/null
2>&1
46 return $?
# "0" if "good" or "nochg" found