1
0
Fork 0
mirror of https://github.com/tunix/digitalocean-dyndns synced 2024-12-22 21:09:52 +00:00

Compare commits

..

8 commits

Author SHA1 Message Date
Alper Kanat
0ed4ab05cf
Merge pull request #16 from otherguy/master
Add bash to Dockerfile, add additional service and logging
2020-12-14 13:01:39 +03:00
Alper Kanat
4ec2969d4a
Update dyndns.sh 2020-12-14 13:00:50 +03:00
Alper Kanat
2a52ffae9d
Update Dockerfile 2020-12-14 12:58:43 +03:00
Alper Kanat
b04f0e19fe
Merge pull request #15 from AxelanderK/fix
Add bash to Dockerfile
2020-12-14 12:57:58 +03:00
Alper Kanat
f9d6d9b7c7
Update Dockerfile 2020-12-14 12:57:34 +03:00
Alecander Graf
3bb7a0232b
Add logging, fix indent, add additional service 2020-12-13 23:09:34 +01:00
Alecander Graf
baf12a3806
Add bash to Dockerfile 2020-12-13 23:09:19 +01:00
Alexander Karlsson
59a389e323 Add bash to Dockerfile 2020-12-13 22:02:13 +00:00
2 changed files with 8 additions and 4 deletions

View file

@ -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

View file

@ -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,10 +30,11 @@ 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")
@ -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