From 13aa7a179e39835b25c61c2c7f2b7acc886b4f0f Mon Sep 17 00:00:00 2001 From: "Jason D. McCormick" Date: Fri, 15 Mar 2019 19:10:27 -0400 Subject: Add IP overrides --- he-dyndns | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'he-dyndns') diff --git a/he-dyndns b/he-dyndns index 3647c67..0ce3730 100755 --- a/he-dyndns +++ b/he-dyndns @@ -12,7 +12,12 @@ usage() { echo "Usage: $0 [-s SECRET] -d HOSTNAME[,HOSTNAME,...]" 1>&2; exit 1; ## DO THE UPDATE FUNCTION ONCE FOR HAPPY EDITING ## doUpdate() { - /usr/bin/curl -s$1 "https://$FQDN:$CODE@$DNSSITE/nic/update?hostname=$FQDN" > $tfile + + if [ ! -z $2 ]; then + myip="&myip=$2" + fi + + /usr/bin/curl -s$1 "https://$FQDN:$CODE@$DNSSITE/nic/update?hostname=$FQDN$myip" > $tfile if ! egrep -q '(good|nochg)' $tfile; then echo -n "v$1 change: " cat $tfile @@ -22,7 +27,7 @@ doUpdate() { } ## MAIN ## -while getopts "46hd:s:" arg; do +while getopts "46a:A:hd:s:" arg; do case "${arg}" in 4) DO4=Y @@ -30,6 +35,12 @@ while getopts "46hd:s:" arg; do 6) DO6=Y ;; + a) + ADDR4=${OPTARG} + ;; + A) + ADDR6=${OPTARG} + ;; d) FQDNS=${OPTARG} ;; @@ -66,11 +77,11 @@ tfile=$(/bin/mktemp) for FQDN in $(echo $FQDNS | tr ',' ' ') do if [ ! -z ${DO4} ]; then - doUpdate 4 + doUpdate 4 ${ADDR4} fi if [ ! -z ${DO6} ]; then - doUpdate 6 + doUpdate 6 ${ADDR6} fi done -- cgit v1.2.3