2 #.Distributed under the terms of the GNU General Public License (GPL) version 2.0
4 # script for sending updates to no-ip.com / noip.com
5 #.2014-2015 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
7 # This script is parsed by dynamic_dns_functions.sh inside send_update() function
9 # provider did not reactivate records, if no IP change was recognized
10 # so we send a dummy (localhost) and a seconds later we send the correct IP addr
13 local __UPDURL
="http://[USERNAME]:[PASSWORD]@dynupdate.no-ip.com/nic/update?hostname=[DOMAIN]&myip=[IP]"
14 # inside url we need username and password
15 [ -z "$username" ] && write_log
14 "Service section not configured correctly! Missing 'username'"
16 [ -z "$password" ] && write_log
14 "Service section not configured correctly! Missing 'password'"
18 # set IP version dependend dummy (localhost)
19 [ $use_ipv6 -eq 0 ] && __DUMMY
="127.0.0.1" || __DUMMY
="::1"
21 # lets do DUMMY transfer
22 write_log
7 "sending dummy IP to 'no-ip.com'"
23 __URL
=$
(echo $__UPDURL |
sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
24 -e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__DUMMY#g")
25 [ $use_https -ne 0 ] && __URL
=$
(echo $__URL |
sed -e 's#^http:#https:#')
27 do_transfer
"$__URL" ||
return 1
29 write_log
7 "'no-ip.com' answered:\n$(cat $DATFILE)"
30 # analyse provider answers
31 # "good [IP_ADR]" = successful
32 # "nochg [IP_ADR]" = no change but OK
33 grep -E "good|nochg" $DATFILE >/dev
/null
2>&1 ||
return 1
38 # now send the correct data
39 write_log
7 "sending real IP to 'no-ip.com'"
40 __URL
=$
(echo $__UPDURL |
sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
41 -e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
42 [ $use_https -ne 0 ] && __URL
=$
(echo $__URL |
sed -e 's#^http:#https:#')
44 do_transfer
"$__URL" ||
return 1
46 write_log
7 "'no-ip.com' answered:\n$(cat $DATFILE)"
47 # analyse provider answers
48 # "good [IP_ADR]" = successful
49 # "nochg [IP_ADR]" = no change but OK
50 grep -E "good|nochg" $DATFILE >/dev
/null
2>&1
51 return $?
# "0" if "good" or "nochg" found