summarylogtreecommitdiffstats
path: root/duckdns.sh
blob: f6243e11bd1782c161606b978955d8126af4613e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

logger -t DuckDNS "Updating DuckDNS entries"
EXITCODE=0
for file in /etc/duckdns.d/*.cfg
do
	. "${file}"
	logger -t DuckDNS "Executing config file '${file}'"
	OUTPUT=$(curl --silent "https://www.duckdns.org/update?domains=${duckdns_hostname}&token=${duckdns_token}&ip=")
	logger -t DuckDNS ${OUTPUT}
	if [ "${OUTPUT}" = "KO" ]; then
		logger -t DuckDNS "You should check if your domain/token is correct because the server responded negatively!"
		EXITCODE=1
	fi
done

exit $EXITCODE