Last active
October 5, 2017 12:42
-
-
Save sokolenkoDEV/48a949063bd118fa16d55360b51b9e16 to your computer and use it in GitHub Desktop.
ispmanager 5 change old NS to new
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#old ns - ns1.example.com ns2.example.com | |
#new ns - new1.ns.com new2.ns.com | |
#!/usr/bin/bash | |
cd /root/; | |
#Вывести список всех доменов | |
echo -e "\e[1;32m Get list of domains\e[0m" | |
/usr/local/mgr5/sbin/mgrctl -m ispmgr domain | awk '{print $1}' | awk -F= '{print $2}' > domain-list.txt | |
#Проверить NS севреры для доменов | |
echo -e "\e[1;32m Get list of domains with bad NS\e[0m" | |
for i in `cat domain-list.txt`; do echo $i ; /usr/local/mgr5/sbin/mgrctl -m ispmgr domain.record elid=$i | grep -i "ns" | grep -i "example"; done > domain-check-dns.txt | |
# Получаем список доменов | |
cat domain-check-dns.txt | awk '{print $1}' | awk -F= '{print $2}' | sort | uniq -c | grep -v "SOA" | awk '{print $2}' | sed 's/\.$//' > domain-example.txt | |
# Меняем NS сервера на idns1.ihc.ru idns2.ihc.ru | |
echo -e "\e[1;32m fix bad NS\e[0m" | |
for i in `cat domain-example.txt`; do /usr/local/mgr5/sbin/mgrctl -m ispmgr domain.record.edit elid="$i. NS ns1.example.com." plid="$i" name="$i." ttl="300" rtype=ns domain="new1.ns.com." sok=ok; done | |
for i in `cat domain-example.txt`; do /usr/local/mgr5/sbin/mgrctl -m ispmgr domain.record.edit elid="$i. NS ns2.example.com." plid="$i" name="$i." ttl="300" rtype=ns domain="new2.ns.com." sok=ok; done | |
rm -f { domain-list.txt,domain-check-dns.txt,domain-example.txt} | |
echo -e "\e[1;32m DONE \e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment