]> git.ipfire.org Git - thirdparty/pdns.git/blob - builder-support/specs/pdns-recursor.init
0e0214cb70523989f0c19b7e9d148ad4bfbc194b
[thirdparty/pdns.git] / builder-support / specs / pdns-recursor.init
1 #!/bin/bash
2 #
3 # pdns-recursor This shell script controls the PowerDNS Recursor
4 #
5 # Author: Ruben Kerkhof <ruben@rubenkerkhof.com>
6 #
7 # chkconfig: - 49 51
8 #
9 # description: PowerDNS Recursor is a non authoritative/recursing DNS server
10 # processname: pdns-recursor
11 # config: /etc/pdns-recursor/recursor.conf
12 # pidfile: /var/run/pdns_recursor.pid
13 #
14
15 # . function library
16 . /etc/rc.d/init.d/functions
17
18 RETVAL=0
19
20 PIDDIR=$(awk -F= '/^socket-dir=/ {print $2}' /etc/pdns-recursor/recursor.conf)
21 if [ -z "$PIDDIR" ]; then PIDDIR=/var/run; fi
22 mkdir -p "$PIDDIR"
23
24 start() {
25 echo -n $"Starting pdns-recursor: "
26 daemon /usr/sbin/pdns_recursor --daemon 2>/dev/null
27 RETVAL=$?
28 echo
29 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pdns-recursor
30 }
31
32 stop() {
33 echo -n $"Stopping pdns-recursor: "
34 killproc pdns_recursor
35 echo
36 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pdns-recursor && rm -f $PIDDIR/pdns_recursor.controlsocket
37 }
38
39 restart() {
40 stop
41 start
42 }
43
44 case "$1" in
45 start)
46 start
47 ;;
48 stop)
49 stop
50 ;;
51 restart|force-reload|reload)
52 restart
53 ;;
54 condrestart)
55 [ -f /var/lock/subsys/pdns-recursor ] && restart
56 ;;
57 status)
58 status pdns_recursor
59 RETVAL=$?
60 ;;
61 *)
62 echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
63 exit 1
64 esac
65
66 exit $RETVAL