Skip to content

Instantly share code, notes, and snippets.

@gerlof85
Forked from oliveratgithub/ddns_updater.sh
Last active May 14, 2021 10:20
Show Gist options
  • Save gerlof85/439df8d10968b8282c14919c41458714 to your computer and use it in GitHub Desktop.
Save gerlof85/439df8d10968b8282c14919c41458714 to your computer and use it in GitHub Desktop.
Automatic Dynamics DNS updater using HTTP API calls, prepared for TwoDNS.de / Two-DNS.de (works with any other DDNS Service, allowing IP updates via HTTP API calls)
#!/bin/sh
log="ddns_updater.log.txt"
my_ext_ip=$(curl -sS http://ipv4.icanhazip.com)
echo "\n\n\n===== \
\n$(date -u) \
\nUpdating IP to: $my_ext_ip \n" >> $log
curl -isSX PUT \
-u "[email protected]:YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"ip_address":"'$my_ext_ip'", "activate_wildcard": "false"}' \
https://api.twodns.de/hosts/YOUR_HOSTNAME.dynvpn.de >> $log
exit
@gerlof85
Copy link
Author

updated URL for icanhazip and made field that must be customized more clear

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