File: pdns-recursor.init.d

package info (click to toggle)
pdns-recursor 3.2-4+deb6u1
  • links: PTS
  • area: main
  • in suites: squeeze-lts
  • size: 1,220 kB
  • ctags: 2,721
  • sloc: cpp: 12,564; ansic: 2,587; sh: 510; makefile: 133
file content (89 lines) | stat: -rwxr-xr-x 1,405 bytes parent folder | download | duplicates (6)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
# chkconfig: - 80 75
# description: pdns_recursor is a versatile high performance recursing nameserver

prefix=/usr/
BINARYPATH=/usr/bin/
SBINARYPATH=/usr/sbin/
SOCKETPATH=/var/run

pdns_server=$SBINARYPATH/pdns_recursor

[ -f "$pdns_server" ] || exit 0

doPC()
{
	ret=`$BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null`
}


doPC ping
NOTRUNNING=$?

case "$1" in
	status)
		if test "$NOTRUNNING" = "0" 
		then 
			echo "running"
		else
			echo "not running"
		fi 
	;;	

	stop)
		echo -n "Stopping PowerDNS recursing nameserver: "
		if test "$NOTRUNNING" = "0" 
		then 
			doPC quit
			echo $ret
		else
			echo "not running"
		fi 
	;;		


	force-stop)
		echo -n "Stopping PowerDNS recursing nameserver: "
		killall -v -9 pdns_server
		echo "killed"
	;;

	start)
		echo -n "Starting PowerDNS recursing nameserver: "
		if test "$NOTRUNNING" = "0" 
		then 
			echo "already running"
		else
			$pdns_server --daemon 
			if test "$?" = "0"
			then
				echo "started"	
			fi
		fi 
	;;		

	force-reload | restart)
		echo -n "Restarting PowerDNS recursing nameserver: "
		echo -n stopping and waiting.. 
		doPC quit
		sleep 3
		echo done
		$0 start
	;;

	monitor)
		if test "$NOTRUNNING" = "0" 
		then 
			echo "already running"
		else
			$pdns_server --daemon=no --quiet=no --control-console --loglevel=9
		fi 
	;;		

	*)
	echo pdns [start\|stop\|force-reload\|restart\|status\|monitor]

	;;
esac