script - automatic change A record

Brian Cuttler brian at wadsworth.org
Tue Nov 26 14:14:55 UTC 2013


Mark,

Good point, I'd completely forgotten the value of a shorter
TTL record for cases like this.

On Tue, Nov 26, 2013 at 09:56:45AM +1100, Mark Andrews wrote:
> 
> In message <CAB9EgSx4Vd4zMAATy_R_8kDxcWswP1ig7wsseK+XG-k83_Okew at mail.gmail.com>
> , =?UTF-8?B?UGF3ZcWCIENoLg==?= writes:
> > Hi list,
> > 
> > I would like to write script that change two entry in my zone file: SOA and
> > A record.
> > 
> > I have 2 web site: mail site site1.tld and backup site site2.tld. Script
> > should monitor site1.tld and when site is unavailable it should change A
> > record in zone file to indicate to site2.tld. If site1.tld is available
> > again then A record should indicate to it.
> > Script should change SOA serial number.
> > 
> > Please help with writing a script.
> > 
> > pch0317
> > 
> 
> #!/bin/sh
> while :
> do
> 	if ping -c 5 -t 5 1.2.3.4
> 	then
> 		nsupdate << EOF
> update del host.example.net A
> update add host.example.net 30 A 1.2.3.4
> send
> EOF
> 	elif ping -c 5 -t 5 1.2.3.5
> 		nsupdate << EOF
> update del host.example.net A
> update add host.example.net 30 A 1.2.3.5
> send
> EOF
> 	else
> 		nsupdate << EOF
> update del host.example.net A
> update add host.example.net 30 A 1.2.3.4
> update add host.example.net 30 A 1.2.3.5
> send
> EOF
> 	fi
> 	sleep 60
> done
> 		
> 
> 
> -- 
> Mark Andrews, ISC
> 1 Seymour St., Dundas Valley, NSW 2117, Australia
> PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org
> _______________________________________________
> Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list
> 
> bind-users mailing list
> bind-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind-users
---
   Brian R Cuttler                 brian.cuttler at wadsworth.org
   Computer Systems Support        (v) 518 486-1697
   Wadsworth Center                (f) 518 473-6384
   NYS Department of Health        Help Desk 518 473-0773



More information about the bind-users mailing list