Script For DNS forwarding of all accounts under a RESELLER Account

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 #######################

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: