diff options
author | David Runge <dave@sleepmap.de> | 2019-08-30 17:04:00 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2019-08-30 17:04:00 +0200 |
commit | 5e15b498e8eac0d3b0025771d16c1d09346fc764 (patch) | |
tree | 02584fefddde09ed3641b87eb5738adb91cdcbbf /bin/domain_to_current_ip | |
parent | 1d758f6f0b27e8228521a3018966d08774c31e44 (diff) | |
download | dotfiles-5e15b498e8eac0d3b0025771d16c1d09346fc764.tar.gz dotfiles-5e15b498e8eac0d3b0025771d16c1d09346fc764.tar.bz2 dotfiles-5e15b498e8eac0d3b0025771d16c1d09346fc764.tar.xz dotfiles-5e15b498e8eac0d3b0025771d16c1d09346fc764.zip |
bin/domain_to_current_ip: Adding script to set a gandi domain to point to the current (external) IP.
Diffstat (limited to 'bin/domain_to_current_ip')
-rwxr-xr-x | bin/domain_to_current_ip | 12 |
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 |