Skip to content

Instantly share code, notes, and snippets.

@JoelLisenby
Last active August 22, 2021 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelLisenby/79a2c8094ff3d32fc6d18b1f3c1a9708 to your computer and use it in GitHub Desktop.
Save JoelLisenby/79a2c8094ff3d32fc6d18b1f3c1a9708 to your computer and use it in GitHub Desktop.
A simple Dynamic DNS script for use with crontab for Linode Domain DNS Records API using dig and linode-cli from python pip
#!/bin/bash
domainid=000000
recordid=0000000
wanip=`dig @resolver4.opendns.com myip.opendns.com +short`
oldip=`linode-cli domains records-view $domainid $recordid --text --no-header --format="target"`
if [ $oldip != $wanip ]
then
linode-cli domains records-update $domainid $recordid --target $wanip
else
echo "no ip change"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment