Last active
April 17, 2016 02:58
-
-
Save silenvx/15d58473c201f1b7a2563cb2a09a3059 to your computer and use it in GitHub Desktop.
DDNS update
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/sh | |
GLOBAL_IP=` echo $SSH_CONNECTION|cut -f1 -d " "` | |
HOST_NAME="sub.noter.jp" | |
TTL="3600" | |
echo $GLOBAL_IP|grep -E '^((([0-1]?[0-9]|2[0-4])?[0-9]|25[0-5])\.){3}(([0-1]?[0-9]|2[0-4])?[0-9]|25[0-5])$' > /dev/null | |
if [ $? -eq 0 ];then | |
echo " | |
server 127.0.0.1 | |
update delete $HOST_NAME | |
update add $HOST_NAME $TTL A $GLOBAL_IP | |
send | |
"|nsupdate | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment