summaryrefslogtreecommitdiff
path: root/network/nsd/rc.nsd
blob: 55118d9464cff42fa329384c63ab4029e987c0d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#
# Start/stop/restart nsd
#

do_start() {
  if [ -x /usr/sbin/nsd ]; then
    echo "Starting Name Server Daemon:  /usr/sbin/nsd"
    /usr/sbin/nsd -c /etc/nsd/nsd.conf 2> /dev/null
  fi
}

do_stop() {
  echo "Stopping Name Server Daemon"
  kill $(cat /var/run/nsd/nsd.pid) 2> /dev/null
}

do_restart() {
  do_stop
  sleep 1
  do_start
}

do_reload() {
  kill -HUP $(cat /var/run/nsd/nsd.pid)
}

do_logreopen() {
  do_reload
}

case "$1" in
'start')
 do_start
  ;;
'stop')
  do_stop
  ;;
'restart')
 do_restart
  ;;
'reload')
 do_reload
  ;;
'logreopen')
  do_logreopen
  ;;
*)
  echo "usage $0 start|stop|restart|reload|logreopen"
esac