diff options
| author | Jason D. McCormick <jason@mfamily.org> | 2019-03-15 19:10:27 -0400 |
|---|---|---|
| committer | Jason D. McCormick <jason@mfamily.org> | 2019-03-15 19:10:27 -0400 |
| commit | 13aa7a179e39835b25c61c2c7f2b7acc886b4f0f (patch) | |
| tree | 99c250b77950852be8748b86d105ef4512d81fcc /he-dyndns | |
| parent | c9245cb0c2a0cd4b8e17a20c76a21b7adb98b871 (diff) | |
Add IP overrides
Diffstat (limited to 'he-dyndns')
| -rwxr-xr-x | he-dyndns | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -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 |
