Skip to content

Instantly share code, notes, and snippets.



Last active Jan 17, 2021
What would you like to do?
Namecheap DDNS Updater Bash Script
# make it executable `chmod +x ddns-update`
# move it path `mv ddns-update /usr/bin/`
# setup cronjob for every 15 minutes `crontab -e`
# */15 * * * * ddns-update >/dev/null 2>&1
# dont forget to change your own domain & password
# uncomment if you want internet connection check before running
#while ! ping -c 1 -W 1; do
# echo "DDNS-UPDATE: Waiting internet connection.."
# sleep 2
last_ip=`cat $last_ip_file`
echo "DDNS-UPDATE: OK, Getting public IP address"
ip=$(curl -s
if [ "$ip" == "$last_ip" ]; then
echo "IP Still same, not need to update."
exit 0
echo "DDNS-UPDATE: Public IP is: $ip, Updating IP..."
response=$(curl -s "$host&domain=$domain&password=$password&ip=$ip")
echo $response
echo $ip > $last_ip_file

This comment has been minimized.

Copy link

@calederer calederer commented Mar 25, 2018

I've added some content to your script but can't do a pull for a gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment