aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2019-09-03 12:40:00 +0200
committerDavid Runge <dave@sleepmap.de>2019-09-03 12:40:00 +0200
commit4ad03449263adb6a4b92892400fc583af5ac5cfb (patch)
tree462c4ec97594f64b97e546f6306272661060c5f1
parent835fe0dce9ababe4dcc01761925cbf409878bbff (diff)
parent5e15b498e8eac0d3b0025771d16c1d09346fc764 (diff)
downloaddotfiles-4ad03449263adb6a4b92892400fc583af5ac5cfb.tar.gz
dotfiles-4ad03449263adb6a4b92892400fc583af5ac5cfb.tar.bz2
dotfiles-4ad03449263adb6a4b92892400fc583af5ac5cfb.tar.xz
dotfiles-4ad03449263adb6a4b92892400fc583af5ac5cfb.zip
Merge branch 'master' of sleepmap.de:dave/dotfiles
* 'master' of sleepmap.de:dave/dotfiles: bin/domain_to_current_ip: Adding script to set a gandi domain to point to the current (external) IP.
-rwxr-xr-xbin/domain_to_current_ip12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/domain_to_current_ip b/bin/domain_to_current_ip
new file mode 100755
index 0000000..9c6d962
--- /dev/null
+++ b/bin/domain_to_current_ip
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+set -eou pipefail
+
+[ ! type -p dig &>/dev/null ] && echo "Install dig." && exit 1
+[ ! type -p gandi &>/dev/null ] && echo "Install gandi.cli." && exit 1
+[ $# -ne 1 ] && "Domain name required as argument." && exit 1
+
+current_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
+gandi dns update --ttl 3600 "$1" @ A "$current_ip"
+
+exit 0