Last active
August 29, 2015 14:02
-
-
Save tacitochaves/84c4e486d76cf8c8b35d to your computer and use it in GitHub Desktop.
nsupdate.sh
This file contains 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/bash | |
# | |
# nsupdate.sh | |
# | |
# Script para inserir endereços dinâmicos no servidor de DNS. | |
# variáveis de ambiente | |
KEYNAME="server" | |
HASH="J+fO2y2XYAVhlBSExwF7Bz/07fMd849Cnq3C+8QhuVr+C5imEig9qBUv8HBFHqccXIJ3GFJXRZnkX/0XCkzBng==" | |
SERVER="ns1.tchaves.com.br" | |
ZONE="din.tchaves.com.br" | |
HOST="chaves.din.tchaves.com.br" | |
# descobrir o IP atual da interface dinâmica | |
IP=$1 | |
# definir comando de update | |
NSUPDATE="/usr/bin/nsupdate -y $KEYNAME:$HASH" | |
# conteúdo a ser enviado ao servidor | |
EXEC="server $SERVER\n | |
zone $ZONE\n | |
update delete $HOST A\n | |
update add $HOST 60 A $IP\n | |
send" | |
# executar a atualização | |
echo -e $EXEC | $NSUPDATE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment