updateResellerDNS.sh
Written By Nazeem S
Copy the bellow content and put it in file called "updateResellerDNS.sh" and give permission 755(executable) then run it (sh updateResellerDNS.sh or ./updateResellerDNS.sh)
############# Starting ########################
###############NAZEEM S####################
#############################################
#! /bin/bash
>/var/log/updateResellerDNS.log
>user
>domains
echo -n "Enter Reseller Account Name:--- "
read a
echo -n "Enter IP to be Changed (Source IP):--- "
read b
echo -n "Enter the New IP (Destination IP):--- "
read c
grep $a /etc/trueuserowners |cut -d ':' -f1|sort >user
for i in `cat user`
do
cat /etc/userdomains|grep $i |cut -d: -f1|sort >>domains;
done
for x in `cat domains`
do
ls /var/named/ |grep $x|sort >>updateResellerDNS.log;
done
for y in `cat updateResellerDNS.log`
do
#replace '$b' '$c' --/var/named/$y;
sed -i 's/$b/$c/g' /var/named/$y;
echo "$y---------------- converted"
done
export c=`cat updateResellerDNS.log | wc -l`
echo "Total count of zone files has been updated = $c"
echo "log file on /var/log/updateResellerDNS.log"
#############################################
###############NAZEEM S####################
############### Ending #######################
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment