summaryrefslogtreecommitdiff
path: root/he-dyndns
diff options
context:
space:
mode:
Diffstat (limited to 'he-dyndns')
-rwxr-xr-xhe-dyndns19
1 files changed, 15 insertions, 4 deletions
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