blob: 7916b57bafc231104c462ac4873cad4317136aa0 (
plain)
1 #! /bin/sh
2 #
3 # /etc/rc.d/named: start/stop/restart/reload the bind name service
4 #
5
6 NAMED_CONF=/etc/named.conf
7 RNDC_CONF=/etc/rndc.conf
8 RNDC_KEY=/etc/rndc.key
9 NAMED_USER=named
10
11 case $1 in
12 start)
13 if [ ! -s $RNDC_CONF ]; then
14 echo "Creating $RNDC_CONF and $RNDC_KEY .."
15 /usr/sbin/rndc-confgen > $RNDC_CONF
16 head -5 $RNDC_CONF | grep -v "^#" > $RNDC_KEY
17 fi
18
19 # DON'T RUN BIND AS ROOT NOR NOBODY !
20 /usr/sbin/named -c $NAMED_CONF -u $NAMED_USER &
21 ;;
22 stop)
23 TEST=`pidof /usr/sbin/named`
24 if [ "$TEST" = "" ] ; then
25 echo "Bind is not running!"
26 else
27 kill -TERM $TEST
28 fi
29 ;;
30 restart)
31 $0 stop
32 $0 start
33 ;;
34 reload)
35 TEST=`pidof /usr/sbin/named`
36 if [ "$TEST" = "" ] ; then
37 $0 start
38 else
39 echo "Reloading bind.."
40 kill -HUP $TEST
41 fi
42 ;;
43 *)
44 echo "Usage: $0 [start|stop|restart|reload]"
45 exit 1
46 ;;
47 esac
48
49 #
50 # End of file
51 #
|