ydns / bash-updater

YDNS Bash Updater Script
GNU General Public License v3.0
80 stars 43 forks source link

multiple dns records #48

Closed witte1000 closed 7 years ago

witte1000 commented 7 years ago

Hello,

Would it be possible for creating the script in that way so it can handle multiple dns records ? Let me explain.

I'm using NGINX as loadbalancer and using internal ip addressen for connecting to my webapplications who are installed on different zones.

I only need 1 public ip but multiple dns records connected to this 1 public ip.

so that I have as example

test.ydns.eu test2.test.ydns.eu test3.test.ydns.eu

all connected to 1 public ip.

I did already modify your script with copy pasting all the pieces to each other and works fine but every time researching all the script and modifying take a lot of time specially if i just want to test for a couple of hours or day's.

Also today after modifying again your script for another application what I just installed, I saw with running the script following

PRD@PRD:~$ ./YDNS_updater.sh -V [2017/09/05T11:43:47] Current IP: 213.211.142.66 [2017/09/05T11:43:47] Current IP: 213.211.142.66 [2017/09/05T11:43:48] Current IP: 213.211.142.66 [2017/09/05T11:43:48] Current IP: 213.211.142.66 [2017/09/05T11:43:49] YDNS host update failed: blablabla.ydns.eu (ok ok ok ok)

So I really mess up somewhere ....

I could use 4 or 5 scripts but it's much easier having everything in 1 script this way if I upgrade my router which cleans everything all the time (other story) I can just copy 1 script back and I'm back in business.

Thank you very much for understanding.

Kind Regards,

Dirk

commx commented 7 years ago

Hi Dirk,

I've pushed an update for the script which allows you to use the "-H" option multiple times to update multiple hosts at once, for example:

./YDNS_updater.sh -H test.ydns.eu -H test2.ydns.eu -H test3.ydns.eu -V

You can also "hard code" the hosts into the YDNS_HOST variable inside the script: simply separate your hosts with space:

YDNS_HOST="test.ydns.eu test2.ydns.eu"

Best regards

witte1000 commented 7 years ago

Hello,

Thank you very much it's an illumination :)

Now I see your solution it make all sense but hadn't never can do it by myself.

However I had to modify the line 173 => put "" between the $YDNS_LASTIP_FILE

get => ./YDNS_updater_Multiple.sh: line 173: $YDNS_LASTIP_FILE: ambiguous redirect

echo "$current_ip" > "$YDNS_LASTIP_FILE"

now it's works perfectly :)

Much appreciations.

Kind Regards,

Dirk