New installation of BIND on Oracle Linux

chris liesfield chris.liesfield at gmail.com
Wed Dec 2 23:53:38 UTC 2015


OK. It's been a while since I've done sys-admin and it shows.

It appears BIND isn't starting on system reboot and whenever I restart the
daemon, using the rc script, all I do is spawn another process, so I have
multiple instances running in parallel, every time I run the restart script
...

Following restart:-

[root at sromelextdns02 init.d]# service named status
named is stopped

Attempt to start:-

[root at sromelextdns02 init.d]# service named restart
Shutting down named:                                       [FAILED]
Starting named:                                            [  OK  ]

[root at sromelextdns02 init.d]# service named status
named dead but subsys locked

Yet, I can still perform an nslookup on the local host, using the IP of
eth0 as the server ...

Here is our script:-

#!/bin/sh
#
# named           This shell script takes care of starting and stopping
#                 named (BIND DNS server).
#
# chkconfig: 345 55 45
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/local/sbin/named ] || exit 0
# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting named: "
        daemon /usr/local/sbin/named -u named -t /var/named -c
/etc/named.conf
        echo
        touch /var/lock/subsys/named
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down named: "
        killproc named
        rm -f /var/lock/subsys/named
        echo
        ;;
  status)
        status named
        exit $?
        ;;
  restart)
        $0 stop
        $0 start
        exit $?
        ;;
  reload)
        /usr/local/sbin/rndc reload
        exit $?
        ;;
  probe)
        # named knows how to reload intelligently; we don't want linuxconf
        # to offer to restart every time
        /usr/local/sbin/rndc reload >/dev/null 2>&1 || echo start
        exit 0
        ;;
  *)
        echo "Usage: named {start|stop|status|restart|reload}"
        exit 1
esac
exit 0

On Wed, Dec 2, 2015 at 9:54 PM, Tony Finch <dot at dotat.at> wrote:

> chris liesfield <chris.liesfield at gmail.com> wrote:
> >
> > # See how we were called.
> >
> > case "$1" in
> > start)
> > # Start daemons.
> > echo -n "Starting named: "
> > daemon /usr/local/sbin/named -u named -t /var/named -c /etc/named.conf
> > echo
> > touch /var/lock/subsys/named
> > ;;
>
> I often find that it's helpful for rc scripts to ensure the chroot is set
> up correctly in the start action: set up device files, directories and
> permissions, create rndc.key if it is missing. It's fairly common for rc
> scripts which have the option of running named either chrooted or not to
> copy files from /etc to the chroot whenever starting or reloading the
> server.
>
> Some of the chroot setup can be redundant if you have a good configuration
> management tool - I like Ansible.
>
> After starting named I wait for it to finish loading everything (to avoid
> races) then fix the permissions on the nsupdate key.
>
>         while   ! rndc status >/dev/null 2>&1
>         do      sleep 0.1
>         done
>         chmod g+r $RUN/session.key
>
> Similarly when stopping:
>
>         # dummy argument in case named is not running
>         set $(rndc stop -p 2>/dev/null) "dummy"
>         while   kill -0 $2 2>/dev/null
>         do      echo -n "."
>                 sleep 0.1
>         done
>
> Tony.
> --
> f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
> Fisher: Southwest 5 to 7 veering northwest 4 or 5. Moderate or rough. Fair
> then rain. Good, becoming moderate or poor.
>



-- 
Chris.

\(")/
-( )-
/(_)\
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20151203/8b3e79b3/attachment.html>


More information about the bind-users mailing list