Skip to content

Instantly share code, notes, and snippets.

@gerlof85
gerlof85 / ddns_updater_v2.sh
Last active May 17, 2021 13:22
updated twodns updater, which only calls the API if current external ip is different from the one stored in current_ip.txt
# !/bin/sh
path="/usr/local/bin/twodns/"
# create file if it doesn't exist
if ! test -f $path"current_ip.txt"; then
echo "empty" > $path"current_ip.txt"
fi
ip_address=`cat /usr/local/bin/twodns/current_ip.txt`
@gerlof85
gerlof85 / ddns_updater.sh
Last active May 14, 2021 10:20 — forked from oliveratgithub/ddns_updater.sh
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 "YOUR@LOGINNAME.COM:YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"ip_address":"'$my_ext_ip'", "activate_wildcard": "false"}' \