Check URLs and update a DNS service

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
HiThere
Posts: 2
Joined: 12 Feb 2018 09:49

Check URLs and update a DNS service

#1 Post by HiThere » 12 Feb 2018 10:46

Hi there...

On the first PC i have a webserver running, reachable over a DNS service url from No-Ip.com (blabla.noip.com). This url just contains the external IP of the PC.
For the case that this PC or its line or the webserver fails somehow, i have a second backup PC on another line and external IP with a backup webserver running.
So if the site "blabla.noip.com" is not available, a batch script, running on the backup PC, should update the No.ip.com DNS service with the IP from the backup PC. That´s it.

This is what it need to do in detail:
1. Check URL:
It must try to open an URL (=blabla.noip.com:80/testfile.php), and save what you get back if you correctly open that URL (what a browser would display) in a variable. If this variable = "Test ok" (a preset string), then the check should be ok.
2. Perform this check 5 times
It must do this check every x minutes for x times. If all of these x checks are not ok, then do the next, otherwise end the script.
3. Check another url (the one from the backup server)
It must do the same as in 1. and 2. for another url (=blablaBACKUP.noip.com:80/testfile.php), except it must end the script if the url is NOT ok.
4. update No-IP DNS service
If the first Url is down 5 times, and the second is up 1 times, it must update the DNS service with the IP from the backup PC (or the one in "blablaBACKUP.noip.com").
This is working by sending an url like:
"http://username:password@dynupdate.no-ip.com/nic/update?hostname=blabla.noip.com&myip=youripaddress"
See --->https://www.noip.com/docs/crosswalk.pdf

Thanks in advance! :-)
Heinz

btw, of cause i googled for it first, and tryed it all day first, but i got just nothing running :-(. Seems that i´m simply too stupid for that.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Check URLs and update a DNS service

#2 Post by Squashman » 12 Feb 2018 11:23

Why not just use the client that NoIP provides for updating the dynamic IP address?

HiThere
Posts: 2
Joined: 12 Feb 2018 09:49

Re: Check URLs and update a DNS service

#3 Post by HiThere » 12 Feb 2018 11:35

Because the Update Client is all the time open and running anyway to update the address "blablaBACKUP.noip.com", since this address must contain always the actual IP from the backup PC.

Post Reply