script - automatic change A record

Kumar, Naveen, Vodafone Group naveen.kumar32 at vodafone.com
Tue Nov 26 07:10:19 UTC 2013


Hi Mark,

If your target server has tcp port, you can create SRV record, DNS server will do the healthcheck and failover accordingly.
I think you can try this!!!

Regards,
Naveen
-----Original Message-----
From: bind-users-bounces+naveen.kumar32=vodafone.com at lists.isc.org [mailto:bind-users-bounces+naveen.kumar32=vodafone.com at lists.isc.org] On Behalf Of Mark Andrews
Sent: Tuesday, November 26, 2013 4:27 AM
To: Paweł Ch.
Cc: bind-users
Subject: Re: script - automatic change A record


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

Vodafone Group Services Limited, One Kingdom Street, Paddington Central, London W2 6BY.

www.vodafone.com	

This message and any files or documents attached are confidential and may also be legally privileged, protected from disclosure 
and/or protected by other legal rules. It is intended only for the individual or entity named. If you are not the named addressee 
or you have received this email in error, please inform the sender immediately, delete it from your system and do not copy or 
disclose it or its contents or use it for any purpose. Thank you. Please also note that transmission cannot be guaranteed to be 
secure or error-free. 



More information about the bind-users mailing list