Skip to content

Instantly share code, notes, and snippets.

@smichaelsen
Created September 22, 2014 21:01
Show Gist options
  • Save smichaelsen/e9fe567ccb6f5efbfb85 to your computer and use it in GitHub Desktop.
Save smichaelsen/e9fe567ccb6f5efbfb85 to your computer and use it in GitHub Desktop.
poor man's dyndns for host europe
#!/bin/sh
KUNDENNR=XXXXXX
PASSWORD=XXXXXX
IP=$(wget -qO- ifconfig.me/ip)
UPDATEIP=false
if [ -f /var/run/current.ip ]
then
oldIP=$(cat /var/run/current.ip)
if [ $oldIP != $IP ]
then
UPDATEIP=true
fi
else
echo $IP > /var/run/current.ip
UPDATEIP=true
fi
if $UPDATEIP ; then
curl -k --url "https://kis.hosteurope.de/?kdnummer=$KUNDENNR&passwd=$PASSWORD"
DOMAIN="mydomain.tld"
HOSTID=XXXXXX
curl -k --url "https://kis.hosteurope.de/administration/domainservices/index.php?record=A&pointer=$IP&menu=1&mode=autodns&domain=$DOMAIN&submode=edit&truemode=host&hostid=$HOSTID&submit=Update" -c /dev/null >/dev/null 2>1
DOMAIN="mydomain2.tld"
HOSTID=XXXXXX
curl -k --url "https://kis.hosteurope.de/administration/domainservices/index.php?record=A&pointer=$IP&menu=1&mode=autodns&domain=$DOMAIN&submode=edit&truemode=host&hostid=$HOSTID&submit=Update" -c /dev/null >/dev/null 2>1
fi
@smichaelsen
Copy link
Author

I have this running as cronjob every 30 minutes on my Synology Diskstation:

/etc/crontab

0,30    *       *       *       *       root    /path/to/script/update_dns_hosteurope.sh

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