wok view 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
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="$(_ '%s daemon' Named)"
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 _ '%s is already running.' $NAME
23 exit 1
24 fi
25 action 'Starting %s: %s...' "$DESC" $NAME
26 $DAEMON $OPTIONS
27 status
28 ;;
29 stop)
30 if ! active_pidfile $PIDFILE named ; then
31 _ '%s is not running.' $NAME
32 exit 1
33 fi
34 action 'Stopping %s: %s...' "$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 _ '%s is not running.' $NAME
45 exit 1
46 fi
47 action 'Restarting %s: %s...' "$DESC" $NAME
48 /usr/sbin/rndc stop
49 sleep 2
50 $DAEMON $OPTIONS
51 status
52 ;;
53 *)
54 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
55 newline
56 exit 1
57 ;;
58 esac
60 exit 0