-
-
Save wmalgadey/acb1553bd2a33b37c4d594ad9dab85ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment