wok view bind/stuff/etc/init.d/named @ rev 2286
Ajaxterm, bind: improve start script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Feb 21 21:27:14 2009 +0000 (2009-02-21) |
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