Ddns http ip
Zur Navigation springen
Zur Suche springen
#!/bin/bash echo "Running ddns..." >> /var/log/ddns.log TTL=1 SERVER="178.147.213.89" HOSTNAME="beebox.ferene.de" KEY="KjtjG8fG1mggHopgGX7Nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==" KEYNAME="ferene.de" #IP=$(ifconfig eth1 | grep "inet addr" | tr -s " " | cut -f 3 -d " " | cut -f 2 -d :) OLD=$(host $HOSTNAME | cut -f 4 -d " ") NEW=$(wget -O - -q icanhazip.com) #echo "OLD: $OLD" #echo "NEW: $NEW" if test $OLD != $NEW then IP=$NEW date >> /var/log/ddns.log nsupdate -v >> /var/log/ddns.log << EOF key $KEYNAME $KEY server $SERVER update delete $HOSTNAME A update add $HOSTNAME $TTL A $IP send EOF cat >> /var/log/ddns.log << EOF key $KEYNAME $KEY server $SERVER update delete $HOSTNAME A update add $HOSTNAME $TTL A $IP send EOF fi