#!/bin/sh
#

# Control the Internet name servic

PATH=/sbin:/usr/sbin:/usr/bin:/bin
export PATH

[ -f /etc/named.conf ] || exit 0
case "$1" in
     'start')
           if [ -x /usr/local/sbin/named ];
           then
                /usr/local/sbin/named;
                echo "Internet name service started"
           fi                       
           ;;
    'stop')
           if [ -r /var/run/named.pid ];
           then
               Pid=`cat /var/run/named.pid`
               kill -9 $Pid
               sleep 2
               echo "Internet name service stopped"
           fi
           ;;
   'restart')
          if [ -r /var/run/named.pid ];
          then
              Pid=`cat /var/run/named.pid`
              kill -1 $Pid
              sleep 5
              echo "Internet name service restarted"
          fi
          ;;
  *)
          echo "usage: $0 {start|stop|restart}"
          exit 1
esac

exit 0

