LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-21-2004, 02:14 AM   #1
freelinuxcpp
Member
 
Registered: Jul 2003
Posts: 129

Rep: Reputation: 15
ADD an auto DNS record !


hello everybody
i wxanna write a little script that add a new zone to my DNS server , the main task are :

1) insert the following line to /etc/bindd9/named.conf :
Quote:
zone "$domaine" {
type master;
file "$domaine";
};
2) creat the record file in /var/named/ which has to look like this :
Quote:
@ IN SOA admin. admin.$domaine.com. (
1997022700 ; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ; default_ttl
)
@ IN NS ns
@ IN MX 10 mail
mail IN A $ip
ns IN A $ip
www IN A $ip
@ IN A $ip
i have to set sedault value for each variable , then the user will just puch enter to set the default , my pb now is how to INSERT these ilnes into named.conf .
thnx for any suggestion.
 
Old 01-25-2004, 02:16 AM   #2
freelinuxcpp
Member
 
Registered: Jul 2003
Posts: 129

Original Poster
Rep: Reputation: 15
as no body has answred , here is my test script
Quote:
#!/bin/sh
clear


echo "Ajoute un nouveau record DNS"
echo
echo -n "Entrez le nom du nouveau domaine ,exp wanadoo.dz :"
read domaine

echo -n "Entrez l'adresse IP du serveur MAIL [10.10.90.24]:"
read mail

if [ -z $mail ];then
smail="10.10.90.24"
else
smail="$mail"
fi

echo -n "Entrez l'adresse IP du serveur DNS [10.10.90.29]:"
read dns
if [ -z $dns ];then
sdns="10.10.90.29"
else
sdns="$dns"
fi

echo -n "Entrez l'adresse IP du serveur WEB [10.10.90.22]:"
read web
if [ -z $web ];then
sweb="10.10.10.1"
else
sweb="$web"
fi

echo
echo

if [ -z $domaine ];then
echo "Vous n'avez rien mis , bye"
exit 0
else
echo
echo
cp /etc/named.conf /etc/named.bkp
echo "zone "\"$domaine\"" { " >> /etc/named.conf
echo " type master; " >> /etc/named.conf
echo " file "\"$domaine\""; " >> /etc/named.conf
echo "}; " >> /etc/named.conf
echo "Creation du fichier /var/bind9/$domaine"
echo
echo "" > /var/named/"$domaine"
echo "@ IN SOA admin. admin.djazair-connect.com. (" >> /var/named/"$domaine"
echo " 1997022700 ; serial " >> /var/named/"$domaine"
echo " 28800 ; refresh " >> /var/named/"$domaine"
echo " 14400 ; retry " >> /var/named/"$domaine"
echo " 3600000 ; expire " >> /var/named/"$domaine"
echo " 86400 ; default_ttl " >> /var/named/"$domaine"
echo " ) " >> /var/named/"$domaine"
echo "@ IN NS ns " >> /var/named/"$domaine"
echo "@ IN MX 10 mail " >> /var/named/"$domaine"
echo "mail IN A $smail " >> /var/named/"$domaine"
echo "ns IN A $sdns " >> /var/named/"$domaine"
echo "www IN A $sweb " >> /var/named/"$domaine"
echo "@ IN A $sdns " >> /var/named/"$domaine"

if [ -f /var/named/$domaine ];then echo "mise a jour du fichier de domaine reussite"
fi
echo "Redemarrage du serveur DNS ..."
service named restart

fi
cat /etc/named.conf
cat /var/named/"$domaine"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind DNS record macadam Linux - Networking 4 06-11-2005 08:18 AM
need to add static dns record silvereye Linux - Software 10 12-20-2004 10:49 AM
howto add filename to each record? kscott121 Programming 4 09-14-2004 10:13 AM
Streamripper script to auto record Nigel_Tufnel Linux - Software 0 05-28-2004 11:33 AM
Free DNS record?... BCE_HAMAHA General 5 03-26-2002 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration