#!/bin/sh

########################################################################
# Begin bind
#
# Description : Start Berkeley Internet Name Daemon
#
# Author      : DJ Lucas - dj@linuxfromscratch.org
#               Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version     : LFS 7.0
#
########################################################################

### BEGIN INIT INFO
# Provides:            bind
# Required-Start:      $time $network
# Should-Start:
# Required-Stop:       $network
# Should-Stop:         $remote_fs
# Default-Start:       3 4 5
# Default-Stop:        0 1 2 6
# Short-Description:   DNS Daemon
# Description:         Provides a local DNS daemon in a chroot environment
# X-LFS-Provided-By:   BLFS / LFS 7.0
### END INIT INFO

. /lib/lsb/init-functions

#$LastChangedBy: randy $
#$Date: 2013-02-12 10:13:34 -0600 (Tue, 12 Feb 2013) $

case "$1" in
   start)
      log_info_msg "Starting named..."
      start_daemon /usr/sbin/named -u named -t /srv/named -c /etc/named.conf
      evaluate_retval
      ;;

   stop)
      log_info_msg "Stopping named..."
      killproc /usr/sbin/named
      evaluate_retval
      ;;

   restart)
      $0 stop
      sleep 1
      $0 start
      ;;

   reload)
      log_info_msg "Reloading named..."
      /usr/sbin/rndc -c /etc/rndc.conf reload
      evaluate_retval
      ;;

   status)
      statusproc /usr/sbin/named
      ;;

   *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
      ;;
esac

# End /etc/init.d/bind
