The DNS installation configuration for shell scripts

Source: Internet
Author: User

conf= "/var/named/chroot/etc/named.conf"

Datadir= "/var/named/chroot/var/named"

Rpm-q bind &>/dev/null

If [$?-ne 0];then

Yum-y Install bind Bind-chroot caching*

echo "

Options {

Directory \ "/var/named\";

};

"> $conf

Fi

Read-p "Please input domain:" domain

grep $domain $conf &>/dev/null

If [$?-ne 0];then

echo "

Zone \ "$domain \" in {

Type master;

File \ "$domain \";

};

">> $conf

echo "

\ $ttl 86400

@inSOA$domain. root. $domain. (

2014010101

3h

15m

1w

1d

)

"> $datadir/$domain

Fi


While True

Do

Read-p "Please type of record: (Ns/a/mx/cname)" type

Case $type in

ns

Read-p "Head of FQDN:" Head

Read-p "IP address:" IP

Read-p "Is you sure?" (yes/no) "yn

if [$yn! = yes];then

Continue

Fi


echo "

@inns$head

$headina$ip

">> $datadir/$domain

;;

A

Read-p "Head of FQDN:" Head

Read-p "IP address:" IP

Read-p "Is you sure?" (yes/no) "yn

if [$yn! = yes];then

Continue

Fi

echo "

$headina$ip

">> $datadir/$domain

;;

mx

Read-p "Head of FQDN:" Head

Read-p "IP address:" IP

Read-p "Priority:"

Read-p "Is you sure?" (yes/no) "yn

if [$yn! = yes];then

Continue

Fi

echo "

@inmx$priority$head

$headina$ip

">> $datadir/$domain


;;

CName

Read-p "Aliase of FQDN:" Aliase

READ-P "hostname:" hostname

Read-p "Is you sure?" (yes/no) "yn

if [$yn! = yes];then

Continue

Fi

echo "

$aliaseincname$hostname

">> $datadir/$domain

;;

*)

echo "Usage:type of Record (Ns/a/mx/cname)"

Esac

Read-p "continue to do? (yes/no) "yn

if [$yn! = yes];then

Break

Fi

Done

Service named restart


The DNS installation configuration for shell scripts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.