script - automatic change A record
Mark Andrews
marka at isc.org
Mon Nov 25 22:56:45 UTC 2013
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
More information about the bind-users
mailing list