summaryrefslogtreecommitdiff
path: root/dyndns.sh
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-12-15 13:41:01 +0000
committerJoe Carstairs <me@joeac.net>2025-12-15 13:41:01 +0000
commit00dfd4bc0274070d9bc979593d5aab7cd97b9fc3 (patch)
treebdc3bb04e76f89275ff2637d004ea774f172e559 /dyndns.sh
parent6722b2b23ec6e69181714b52d4a95667127ea5f2 (diff)
fixes
Diffstat (limited to 'dyndns.sh')
-rwxr-xr-xdyndns.sh18
1 files changed, 9 insertions, 9 deletions
diff --git a/dyndns.sh b/dyndns.sh
index 4847154..005264b 100755
--- a/dyndns.sh
+++ b/dyndns.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Work with DigitalOcean api to update "A" and "AAAA" records for a domain.
# Store DigitalOcean API token in file : DIGITALOCEAN_TOKEN
@@ -6,14 +6,8 @@
ip_version="$1"
if [ -z "${ip_version:-}" ] || ([ "$ip_version" != 4 ] && [ "$ip_version" != 6 ]); then
- echo "Error: no valid IP version provided" &>2
- echo "Usage: dyndns.bash <4|6>" &>2
- exit 1
-fi
-
-IP="$(./get_ip_addr.sh $ip_version)"
-if [ -z "$IP" ]; then
- echo "Error: could not find IP address" &>2
+ echo "Error: no valid IP version provided" >&2
+ echo "Usage: dyndns.bash <4|6>" >&2
exit 1
fi
@@ -21,6 +15,12 @@ SCRIPT="$0"
SCRIPT_DIR=$(cd "${SCRIPT%/*}" && pwd )
SCRIPT_NAME=${SCRIPT##*/}
+IP="$($SCRIPT_DIR/get_ip_addr.sh $ip_version)"
+if [ -z "$IP" ]; then
+ echo "Error: could not find IP address" >&2
+ exit 1
+fi
+
REPEAT_CHECK_DIR=$SCRIPT_DIR
REPEAT_CHECK_A=$REPEAT_CHECK_DIR/REPEAT_CHECK_A
REPEAT_CHECK_AAAA=$REPEAT_CHECK_DIR/REPEAT_CHECK_AAAA