DDNS Service for Linode
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

40 lines
989 B

IP="$(curl ipinfo.io/ip)"
OLDIP="$(more current-ip)"
TOKEN="$(more token)"
DOMAIN="$(more domain)"
RECORD="$(more record)"
NAME="$(more name)"
echo Current IP: $IP
echo Old IP: $OLDIP
# # Lists all the domains using a specific token
# curl -H "Authorization: Bearer $TOKEN" https://api.linode.com/v4/domains
# # List all the records for a specific domain
# curl -H "Authorization: Bearer $TOKEN" \
# https://api.linode.com/v4/domains/$DOMAIN/records
if [ "$IP" != "$OLDIP" ]
echo "DNS Requires Updating!"
echo $IP > current-ip
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PUT -d '{
"type": "A",
"name": "'"$NAME"'",
"target": "'"$IP"'",
"priority": 10,
"weight": 5,
"port": 80,
"service": null,
"protocol": null,
"ttl_sec": 0,
"tag": null
}' \
echo "The IPs match, no need to update :)"