Skip to content

Commit

Permalink
Use DIG instead of NSLOOKUP in DDNS apps (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTurnschuh authored and nachoparker committed Oct 7, 2018
1 parent 54e0968 commit c6da8a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion etc/ncp-config.d/DDNS_freeDNS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ configure()
#!/bin/bash
echo "FreeDNS client started"
echo "${URL}"
registeredIP=\$(nslookup ${DOMAIN_}|tail -n2|grep A|sed s/[^0-9.]//g)
registeredIP=$(dig +short "$DOMAIN_"|tail -n1)
currentIP=\$(wget -q -O - http://checkip.dyndns.org|sed s/[^0-9.]//g)
[ "\$currentIP" != "\$registeredIP" ] && {
wget -q -O /dev/null ${URL}
Expand Down
4 changes: 2 additions & 2 deletions etc/ncp-config.d/DDNS_spDYN.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if [ $# -eq 3 ]
then
# if hostname and token
# Get registered IP address
registeredIP=\$(nslookup ${DOMAIN_}|tail -n2|grep A|sed s/[^0-9.]//g)
registeredIP=$(dig +short "$DOMAIN_"|tail -n1)
# Get current IP address
currip=$(curl -s "$get_ip_url");
# Update only when IP address has changed.
Expand All @@ -102,7 +102,7 @@ if [ $# -eq 3 ]
then
# if hostname and user and passwd
# Get registered IP address
registeredIP=\$(nslookup ${DOMAIN_}|tail -n2|grep A|sed s/[^0-9.]//g)
registeredIP=$(dig +short "$DOMAIN_"|tail -n1)
# Get current IP address
currip=$(curl -s "$get_ip_url");
# Update only when IP address has changed.
Expand Down

0 comments on commit c6da8a9

Please sign in to comment.