Last active
July 24, 2022 13:08
-
-
Save bungoume/6052680 to your computer and use it in GitHub Desktop.
cli53を使ってダイナミックDNSをするスクリプトファイル
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 | |
DOMAIN="example.com" | |
IPADDR=`wget -q -O - "http://checkip.dyndns.org" |sed -e 's/[^0-9]*\([0-9\.]*\).*/\1/'` | |
DOMAINIP=`cli53 rrlist $DOMAIN|grep $'\tA\t'|cut -f5` | |
if [ $IPADDR != $DOMAINIP ]; then | |
cli53 rrdelete $DOMAIN @ A | |
cli53 rrcreate $DOMAIN @ A $IPADDR | |
echo "$DOMAINIP to $IPADDR" | |
else | |
echo "ip:$IPADDR is not changed." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment