Add DNS server (#83)

Add DNS server
This commit is contained in:
Pascal Vizeli
2017-05-23 17:18:14 +02:00
committed by GitHub
parent e653ed73bf
commit 2cb7569634
5 changed files with 127 additions and 13 deletions

View File

@@ -3,21 +3,13 @@ set -e
CONFIG_PATH=/data/options.json
TOKEN=$(jq --raw-output ".token" $CONFIG_PATH)
DOMAINS=$(jq --raw-output ".domains[]" $CONFIG_PATH)
WAIT_TIME=$(jq --raw-output ".seconds" $CONFIG_PATH)
TOKEN=$(jq --raw-output '.token' $CONFIG_PATH)
DOMAINS=$(jq --raw-output '.domains | join(",")' $CONFIG_PATH)
WAIT_TIME=$(jq --raw-output '.seconds' $CONFIG_PATH)
for line in $DOMAINS; do
if [ -z "$DOMAIN_ARG" ]; then
DOMAIN_ARG="$line"
else
DOMAIN_ARG="$DOMAIN_ARG,$line"
fi
done
#
# Run duckdns
while true; do
ANSWER="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAIN_ARG&token=$TOKEN&ip=&verbose=true")"
ANSWER="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&ip=&verbose=true")"
echo "$(date): $ANSWER"
sleep "$WAIT_TIME"
done