wok annotate bind/stuff/etc/init.d/named @ rev 1937

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