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

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents 297964ebacad
children ff5fd8788cd9
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
al@19159 12 DESC="$(_ '%s daemon' Named)"
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@2286 21 if active_pidfile $PIDFILE named ; then
al@19159 22 _ '%s is already running.' $NAME
pascal@1612 23 exit 1
pascal@1612 24 fi
al@19159 25 action 'Starting %s: %s...' "$DESC" $NAME
al@19159 26 $DAEMON $OPTIONS
pascal@1612 27 status
pascal@1612 28 ;;
pascal@1612 29 stop)
pascal@2286 30 if ! active_pidfile $PIDFILE named ; then
al@19159 31 _ '%s is not running.' $NAME
pascal@1612 32 exit 1
pascal@1612 33 fi
al@19159 34 action 'Stopping %s: %s...' "$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@2286 43 if ! active_pidfile $PIDFILE named ; then
al@19159 44 _ '%s is not running.' $NAME
pascal@1612 45 exit 1
pascal@1612 46 fi
al@19159 47 action 'Restarting %s: %s...' "$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 *)
al@19159 54 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
al@19159 55 newline
pascal@1612 56 exit 1
pascal@1612 57 ;;
pascal@1612 58 esac
pascal@1612 59
pascal@1612 60 exit 0