wok-6.x view bind/stuff/etc/init.d/named @ rev 8919

Up: tazwok 4.2.2
author Antoine Bodin <gokhlayeh@slitaz.org>
date Tue Mar 01 00:18:27 2011 +0100 (2011-03-01)
parents 43ae0b5f0a8a
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/named: Start, stop and restart Named deamon on SliTaz, at boot
3 # time or with the command line.
4 #
5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Named
12 DESC="Named deamon"
13 DAEMON=/usr/sbin/named
14 OPTIONS=$NAMED_OPTIONS
15 PIDFILE=/var/run/named.pid
16 #[ -n "$OPTIONS" ] || OPTIONS="-u nobody"
17 [ -f /etc/bind/rndc.key ] || rndc-confgen -r /dev/urandom -a
19 case "$1" in
20 start)
21 if active_pidfile $PIDFILE named ; then
22 echo "$NAME already running."
23 exit 1
24 fi
25 echo -n "Starting $DESC: $NAME... "
26 $DAEMON $OPTIONS
27 status
28 ;;
29 stop)
30 if ! active_pidfile $PIDFILE named ; then
31 echo "$NAME is not running."
32 exit 1
33 fi
34 echo -n "Stopping $DESC: $NAME... "
35 /usr/sbin/rndc stop
36 status
37 ;;
38 reload)
39 /usr/sbin/rndc reload
40 status
41 ;;
42 restart)
43 if ! active_pidfile $PIDFILE named ; then
44 echo "$NAME is not running."
45 exit 1
46 fi
47 echo -n "Restarting $DESC: $NAME... "
48 /usr/sbin/rndc stop
49 sleep 2
50 $DAEMON $OPTIONS
51 status
52 ;;
53 *)
54 echo ""
55 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|reload|restart]"
56 echo ""
57 exit 1
58 ;;
59 esac
61 exit 0