2020-08-27 00:26:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
domains="{{ duckdns.domains }}"
|
|
|
|
token="{{ duckdns.token }}"
|
|
|
|
{% if duckdns.logfile is undefined -%}
|
|
|
|
log="/var/log/duckdns.log"
|
|
|
|
{% else -%}
|
|
|
|
log="{{ duckdns.logfile }}"
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
url="https://www.duckdns.org/update?domains=$domains&token=$token&ip="
|
|
|
|
|
|
|
|
time=$(date '+%Y%m%d-%H%M%S')
|
2020-08-27 01:00:08 +00:00
|
|
|
result=$(curl --silent $url)
|
2020-08-27 00:26:05 +00:00
|
|
|
|
|
|
|
if [ "$result" = "OK" ]; then
|
|
|
|
echo "[$time] OK" >> $log
|
|
|
|
else
|
|
|
|
echo "[$time] ERROR: $result" >> $log
|
|
|
|
fi
|