-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspdny-update.sh
33 lines (25 loc) · 954 Bytes
/
spdny-update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Quelle: http://my5cent.spdns.de/de/comment/64#comment-64
# spdns.de | spdyn.de external ip update script
# spdns host vars
# Hier Host und Token eintragen:
dns_host="dynDNS-spdyn.de"
dns_token="xxxx-holf-xxxx"
# 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://update.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 ""
echo ""
echo "spdns update response: $spdns_response"
echo ""
# save result into file
echo $spdns_response
echo $response_file
# done
exit 0