LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to Start Named - DNS Bind on boot-up. (https://www.linuxquestions.org/questions/linux-networking-3/how-to-start-named-dns-bind-on-boot-up-21887/)

360 05-26-2002 08:52 PM

How to Start Named - DNS Bind on boot-up.
 
continued from a different post on how to install and configure DNS Bind: http://www.linuxquestions.org/questi...threadid=21887


9. How to Start Named on boot-up.

We will run a script from /etc/init.d/named on boot-up using a soft link from
/etc/rc3.d/S55named or /etc/rc2.d/S55named,
depending on what your systems init default is.

To find out what your init default is, enter the command:
# vi /etc/inittab

Look for a line such as:
id:3:initdefault
Or
id:2:initdefault

I will use 3 but if yours is 2, change the number to 2 in the following.

You want named to start before such things as ssh and sendmail because
those deamons need DNS to run properly.
So to see what order my soft links are in , I could run the command:
# cd /etc/rc3.d ; ls

I might see that sendmail is S80sendmail so if ip use S55named then named
will start before sendmail because S55 comes before S80.

See if you have a file called /etc/init.d/named by typing the command:
# cd /etc/init.d ; ls

If you do have a filed call /etc/init.d/named, move it incase you need it by
entering the following comman:
# mv /etc/init.d/named /etc/init.d/named_old

Now create a file named /etc/init.d/named and put the following shell script in the file.

//--Begin Shell Script

#!/bin/sh
# Startup script for
#

if ! [ -x /usr/local/sbin/named ]; then
exit 0;
fi

if ! [ -f /etc/named.conf ]; then
exit 0;
fi

prog="named"

start() {
echo -n $"Starting $prog: "
/usr/local/sbin/named &
}

stop() {
echo -n $"Stopping $prog: "
/usr/local/sbin/rndc stop
}

case "$1" in
start)
start
;;

stop)
stop
;;

status)
/bin/ps -ef | grep na[Mm]ed
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1

esac

exit 0

// ---End Shell Script


To creat a soft link from /etc/rc3.d/S55 to the script in /etc/init.d/named,
enter the following command:
ln -s /etc/init.d/named /etc/rc3.d/S55named

restart your server.


All times are GMT -5. The time now is 11:29 AM.