Last active
June 1, 2017 13:35
-
-
Save metalefty/e2112eee04b0097d108737072a69b4ce to your computer and use it in GitHub Desktop.
update-route53: http://w.vmeta.jp/tdiary/20160912.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # The MIT License (MIT) https://opensource.org/licenses/MIT | |
| # Copyright (c) 2016 Koichiro IWAO <meta@vmeta.jp> | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 interface" 1>&2 | |
| exit 1 | |
| fi | |
| # if you want global ip addr | |
| #IP4ADDR=$(curl http://checkip.amazonaws.com) | |
| IP4ADDR=$(ip -o -4 addr show dev ${1} | awk -F '[ /]+' '/global/ {print $4}') | |
| IP6ADDR=$(ip -o -6 addr show dev ${1} | awk -F '[ /]+' '/global/ {print $4}') | |
| if [ -z "${IP4ADDR}" ]; then | |
| cli53 rd "$(hostname -d)" "$(hostname -s)" A | |
| else | |
| cli53 rc --replace "$(hostname -d)" "$(hostname -s) 60 A ${IP4ADDR}" | |
| fi | |
| if [ -z "${IP6ADDR}" ]; then | |
| cli53 rd "$(hostname -d)" "$(hostname -s)" AAAA | |
| else | |
| cli53 rc --replace "$(hostname -d)" "$(hostname -s) 60 AAAA ${IP6ADDR}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment