summaryrefslogtreecommitdiff
path: root/net/knot/files/knotd.init
blob: 23d3bd58e7eb2e14cb6f09eda2cc8501ad35931f (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
#!/bin/sh /etc/rc.common
START=70

knot_bin="/usr/sbin/knotd"
knot_ctl="/usr/sbin/knotc"
config_file="/etc/knot/knot.conf"
pid_file="/var/run/knot.pid"

start() {
  echo "Starting Knot DNS"

  if [ -e $pid_file ]; then
     echo "  Already running with PID `cat $pid_file`"
     return 1
  fi

  $knot_bin -c $config_file -d

  if [ $? -ne 0 ]; then
    echo "  Failed to start"
  fi
}

stop() {
  echo "Stopping Knot DNS"

  if [ -e $pid_file ]; then
    kill `cat $pid_file`
    rm -f $pid_file
  else
    echo "  No PID file $pid_file"
    return 1
  fi
}

restart() {
  stop
  start
}

reload() {
  echo "Reloading Knot DNS"

  $knot_ctl -c $config_file reload
}