summaryrefslogtreecommitdiff
path: root/network/yadifa/rc.yadifa
blob: fdc1cecf6e4b11250a1807c5c77a97517ee55b64 (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
51
52
53
54
55
56
57
#!/bin/sh
#
# Start/stop/restart yadifad
#

do_start() {
  if [ -x /usr/sbin/yadifad ]; then
    if [ ! -d /run/yadifa ]; then
      mkdir -p /run/yadifa
      chown yadifa:yadifa /run/yadifa
    fi
    echo -n "Starting YADIFA DNS Server:  /usr/sbin/yadifad -c /etc/yadifa/yadifad.conf --daemon... "
    /usr/sbin/yadifad -c /etc/yadifa/yadifad.conf --daemon 2> /dev/null
    echo "done."
  fi
}

do_stop() {
  echo -n "Stopping YADIFA DNS Server: "
  kill $(cat /var/run/yadifa/yadifad.pid) 2> /dev/null
  sleep 2
  echo "done."
}

do_restart() {
  do_stop
  sleep 1
  do_start
}

do_reload() {
  /usr/bin/yadifa cfgreload
}

do_logreopen() {
  /usr/bin/yadifa logreopen
}

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