aboutsummaryrefslogtreecommitdiffstats
path: root/bin/domain_to_current_ip
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2019-09-04 22:48:29 +0200
committerDavid Runge <dave@sleepmap.de>2019-09-04 22:48:29 +0200
commitdf393ca6dab397f9520f0ec8974ff88184a7f998 (patch)
treeaed18c17e1272c3cc3ebc0d0f4a7023eddc3b531 /bin/domain_to_current_ip
parent4a78df23346138096b03806d573ae51930712a30 (diff)
parent4ad03449263adb6a4b92892400fc583af5ac5cfb (diff)
downloaddotfiles-df393ca6dab397f9520f0ec8974ff88184a7f998.tar.gz
dotfiles-df393ca6dab397f9520f0ec8974ff88184a7f998.tar.bz2
dotfiles-df393ca6dab397f9520f0ec8974ff88184a7f998.tar.xz
dotfiles-df393ca6dab397f9520f0ec8974ff88184a7f998.zip
Merge branch 'master' of sleepmap.de:dave/dotfiles
* 'master' of sleepmap.de:dave/dotfiles: .config/packages/extra.txt: Adding audiofile, brltty, ddrescue, ladspa, raptop, rasqal and redland. .config/packages/community.txt: Adding flyspray, gandi.cli and python-ipy. bin/domain_to_current_ip: Adding script to set a gandi domain to point to the current (external) IP. .config/packages/community.txt: Adding haskell-{hosc,microspec}, tidalcycles, python-{gitdb,gitpython,gnupg,progressbar,smmap,tzlocal,utils}, librepcb and waf. .config/nvchecker/nvchecker.ini: Fixing freepats-general-midi check. Adding python-{tzlocal,gitdb,gitpython,gnupg,progressbar,smmap}, haskell-{hosc,microspec}, librepcb, waf and tidalcycles. .config/nvchecker/nvchecker.ini: Adding geonkick, hydrogen, php-igbinary, foxdot and redkite. Switching to tracking linux-rt 5.2 branch.
Diffstat (limited to 'bin/domain_to_current_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