Skip to content

Instantly share code, notes, and snippets.

@bungoume
Last active July 24, 2022 13:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bungoume/6052680 to your computer and use it in GitHub Desktop.
Save bungoume/6052680 to your computer and use it in GitHub Desktop.
cli53を使ってダイナミックDNSをするスクリプトファイル
#!/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