mirror of
https://github.com/tunix/digitalocean-dyndns
synced 2024-12-22 21:09:52 +00:00
Compare commits
8 commits
a5ae5cfe52
...
0ed4ab05cf
Author | SHA1 | Date | |
---|---|---|---|
|
0ed4ab05cf | ||
|
4ec2969d4a | ||
|
2a52ffae9d | ||
|
b04f0e19fe | ||
|
f9d6d9b7c7 | ||
|
3bb7a0232b | ||
|
baf12a3806 | ||
|
59a389e323 |
2 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
FROM alpine
|
FROM alpine
|
||||||
MAINTAINER Alper Kanat <tunix@raptiye.org>
|
MAINTAINER Alper Kanat <me@alperkan.at>
|
||||||
RUN apk --no-cache add curl jq
|
RUN apk --no-cache add curl jq bash
|
||||||
COPY dyndns.sh /
|
COPY dyndns.sh /
|
||||||
USER nobody
|
USER nobody
|
||||||
ENTRYPOINT exec /dyndns.sh
|
ENTRYPOINT exec /dyndns.sh
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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"
|
||||||
)
|
)
|
||||||
|
@ -29,9 +30,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
|
||||||
|
@ -51,6 +53,8 @@ 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