Fri, 25.09.2015 - 09:30

Das Ganze ist wesentlich simpler mittels Bash-Skript zu lösen.

Einfach per Cron-Job laufen lassen:

#!/bin/bash
#

# spdns.de external ip update script

# spdns host vars
# Hier Host und Token eintragen:
dns_host="meinserver.spdns.de"
dns_token="abcd-efgh-ijkl"

# define response file (derived from script file)
response_file="$(readlink -f $0).response"

# get external ip
external_ip=`wget "http://checkip4.spdns.de" -O "-" --quiet`

# send update request
spdns_response=`wget --user=$dns_host --password=$dns_token "https://www.spdns.de/nic/update?hostname=$dns_host&myip=$external_ip" -O "-" --quiet`

# display response
[[ ! "`/usr/bin/tty`" == "not a tty" ]] && echo ""
[[ ! "`/usr/bin/tty`" == "not a tty" ]] && echo "spdns update response: $spdns_response"
[[ ! "`/usr/bin/tty`" == "not a tty" ]] && echo ""

# save result into file
echo "$spdns_response" > $response_file

# done
exit 0

Please insert your mail adress. Your mail address will not be displayed.