Closed rafny closed 4 years ago
Hi @rafny, the script only supports updating a single record.
If you want to update multiple records you've got a couple of options:
-r
on the command line will override whatever's in the config file if you're using that.As an example of the CNAME approach, you could have the following:
Record | Type | Value |
---|---|---|
dynamic.foo.com |
A |
<whatever comes from the script> |
thing1.foo.com |
CNAME |
dynamic.foo.com |
thing2.foo.com |
CNAME |
dynamic.foo.com |
I hope that helps.
Hey @rafny, Like @clempaul mentioned you can just run it multiple times or use cnames. If you don't want to have cnames connecting multiple separate domains then multiple times is your next best best.
To prevent going over your dreamhost API rate limits you can make a small script to check if your ip has changed first and only run this script when required.
Here is what I use. If you use it I would recommend adding basic error checking as this will take any errors from eval "dig +short myip.opendns.com @resolver1.opendns.com"
as a new ip.
#!/bin/bash
NewIP=$(eval "dig +short myip.opendns.com @resolver1.opendns.com -4")
read OldIP < OldIP.txt
if [ "$OldIP" != "$NewIP" ]
then
echo Hey, it looks like our IP changed from $OldIP to $NewIP!
/<your path to the script>/dynamicdns.bash -k <API KEY> -r site.tld -i $NewIP
/<your path to the script>/dynamicdns.bash -k <API KEY> -r some.site.tld -i $NewIP
/<your path to the script>/dynamicdns.bash -k <API KEY> -r some.funky.site.tld -i $NewIP
/<your path to the script>/dynamicdns.bash -k <API KEY> -r some.strange.site.tld -i $NewIP
/<your path to the script>/dynamicdns.bash -k <API KEY> -r *.othersite.tld -i $NewIP
echo $NewIP > OldIP.txt
fi
if [ "$OldIP" = "$NewIP" ]
then
echo Hey, it looks like our IP has not changed!
fi
Does this script support updating multiple records with the same ip address? If so, what's the best syntax for it?