mirror of
https://github.com/tunix/digitalocean-dyndns
synced 2024-11-01 00:25:24 +00:00
Compare commits
No commits in common. "0ed4ab05cfcbf86d44d0b3bdc4b0776b9b64583a" and "a5ae5cfe52fa519f0d77c8d88cf2169c32fd2403" have entirely different histories.
0ed4ab05cf
...
a5ae5cfe52
2 changed files with 4 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
FROM alpine
|
FROM alpine
|
||||||
MAINTAINER Alper Kanat <me@alperkan.at>
|
MAINTAINER Alper Kanat <tunix@raptiye.org>
|
||||||
RUN apk --no-cache add curl jq bash
|
RUN apk --no-cache add curl jq
|
||||||
COPY dyndns.sh /
|
COPY dyndns.sh /
|
||||||
USER nobody
|
USER nobody
|
||||||
ENTRYPOINT exec /dyndns.sh
|
ENTRYPOINT exec /dyndns.sh
|
||||||
|
|
|
@ -4,7 +4,6 @@ api_host="https://api.digitalocean.com/v2"
|
||||||
sleep_interval=${SLEEP_INTERVAL:-300}
|
sleep_interval=${SLEEP_INTERVAL:-300}
|
||||||
|
|
||||||
services=(
|
services=(
|
||||||
"ifconfig.co"
|
|
||||||
"ipinfo.io/ip"
|
"ipinfo.io/ip"
|
||||||
"ifconfig.me"
|
"ifconfig.me"
|
||||||
)
|
)
|
||||||
|
@ -30,11 +29,10 @@ while ( true ); do
|
||||||
echo "Trying with $service..."
|
echo "Trying with $service..."
|
||||||
|
|
||||||
ip="$(curl -s $service)"
|
ip="$(curl -s $service)"
|
||||||
|
|
||||||
test -n "$ip" && break
|
test -n "$ip" && break
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Found IP address $ip"
|
|
||||||
|
|
||||||
if [[ -n $ip ]]; then
|
if [[ -n $ip ]]; then
|
||||||
for sub in ${NAME//;/ }; do
|
for sub in ${NAME//;/ }; do
|
||||||
record_id=$(echo $domain_records| jq ".domain_records[] | select(.type == \"A\" and .name == \"$sub\") | .id")
|
record_id=$(echo $domain_records| jq ".domain_records[] | select(.type == \"A\" and .name == \"$sub\") | .id")
|
||||||
|
@ -53,8 +51,6 @@ while ( true ); do
|
||||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||||
-d "$data" \
|
-d "$data" \
|
||||||
"$url" &> /dev/null
|
"$url" &> /dev/null
|
||||||
else
|
|
||||||
echo "existing DNS record address ($record_data) did not need updating"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue