Mailsecure
Make domain list(put the domains the want in here)
vim /root/mailsecurelist
Run this for loop to use the domain list to backup each domains zone file, then remove the old mx entries, and add the new ones as well as update the ttls and serials all at once.
for i in `cat mailsecurelist`; do sed -i.lwbak -e '/IN[[:space:]]*MX/d' /var/named/$i.db; echo "$i. 300 IN MX 0 bmx01.sourcedns.com." >> /var/named/$i.db; echo "$i. 300 IN MX 0 bmx02.sourcedns.com." >> /var/named/$i.db; sed -i -e 's/^\$TTL.*/$TTL 300/g' -e 's/[0-9]\{10\}/'`date +%Y%m%d%H`'/g' /var/named/$i.db; done
test work
for i in `cat /root/mailsecurelist`; do grep --color "\$TTL" /var/named/$i.db; grep --color -e '[0-9]\{10\}' /var/named/$i.db; egrep --color 'IN[[:space:]]*MX' /var/named/$i.db; done
Reload name server.
rndc reload