Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sebastian-muthwill/175469401fa3fec8340c to your computer and use it in GitHub Desktop.
Save sebastian-muthwill/175469401fa3fec8340c to your computer and use it in GitHub Desktop.
#!/bin/sh
#aktualisiert DNS-Einträge bei HostEurope
#XXX durch eigene Zugangsdaten ersetzen
#HostEurope-Zugangsdaten
KUNDENNR=xxx
PASSWORD=xxx
DOMAIN=xxx
#Host-ID des eigentlichen Eintrages
HOSTID=xxx
#Ordner für current.ip und Log Datei
FOLDER=/srv/ip
#externe IP bestimmen und dann vergleichen
IP=$(wget -qO- ifconfig.me/ip)
UPDATEIP=false
if [ -f $FOLDER/current.ip ]
then
#Vergleich, ob IP sich geändert hat, wenn ja, dann Update erzwingen
oldIP=$(cat $FOLDER/current.ip)
if [ $oldIP != $IP ]
then
UPDATEIP=true
fi
else
echo $IP > $FOLDER/current.ip
UPDATEIP=true
fi
#bei Bedarf ein Update machen und IP wieder als current.ip speichern um
#updates bei gleicher IP zu verhindern
if $UPDATEIP ; then
curl -k --url "https://kis.hosteurope.de/?kdnummer=$KUNDENNR&passwd=$PASSWORD" --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" --url"https://kis.hosteurope.de/?logout=1" -c /dev/null >/dev/null 2>1
echo $IP > $FOLDER/current.ip
#IP wird bei Änderung geloggt
DATUM=$(date +"%y-%m-%d")
echo $DATUM $IP >> $FOLDER/ip-update.log
fi
@mmassing
Copy link

Mittlerweile schaltet mir hosteurope immer ein captcha beim login dazwischen, jemand eine Idee ob es da eine Lösung gibt (z.B. auth-token?)

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