#!/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') result=$(curl $url) if [ "$result" = "OK" ]; then echo "[$time] OK" >> $log else echo "[$time] ERROR: $result" >> $log fi