In message <cab9egsx4vd4zmaaty_r_8kdxcwswp1ig7wssek+xg-k83_o...@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: ma...@isc.org
_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to