]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/pdns.init.in
Add some notes explaining why some validations are not relevant in the dnstap case.
[thirdparty/pdns.git] / pdns / pdns.init.in
CommitLineData
fef9fe93 1#!/bin/sh
12c86877
BH
2# chkconfig: - 80 75
3# description: PDNS is a versatile high performance authoritative nameserver
4
88d5b8d2
BH
5### BEGIN INIT INFO
6# Provides: pdns
7# Required-Start: $remote_fs $network $syslog
8# Required-Stop: $remote_fs $network $syslog
69889135
CH
9# Should-Start:
10# Should-Stop:
88d5b8d2
BH
11# Default-Start: 2 3 4 5
12# Default-Stop: 0 1 6
69889135
CH
13# Short-Description: PowerDNS authoritative server
14# Description: PowerDNS authoritative server
88d5b8d2
BH
15### END INIT INFO
16
190cca70
PD
17set -e
18
a96b3f94 19exec_prefix=@exec_prefix@
fef9fe93 20BINARYPATH=@bindir@
1258abe0 21SBINARYPATH=@sbindir@
fef9fe93 22SOCKETPATH=@socketdir@
4a23af75 23DAEMON_ARGS=""
fef9fe93 24
eefd15f9
BH
25[ -f "$SBINARYPATH/pdns_server" ] || exit 0
26
7e62804a
BH
27[ -r /etc/default/pdns ] && . /etc/default/pdns
28
50ede2e0
AT
29[ "$START" = "no" ] && exit 0
30
7e5b3a09
CH
31# Make sure that /var/run exists
32mkdir -p $SOCKETPATH
12c86877 33cd $SOCKETPATH
affeacd2
PD
34suffix=$(basename $0 | cut -d- -f2- -s)
35if [ -n "$suffix" ]
12c86877
BH
36then
37 EXTRAOPTS=--config-name=$suffix
38 PROGNAME=pdns-$suffix
39else
40 PROGNAME=pdns
41fi
42
4a23af75 43pdns_server="$SBINARYPATH/pdns_server $DAEMON_ARGS $EXTRAOPTS"
12c86877
BH
44
45doPC()
46{
47 ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)
48}
49
190cca70
PD
50NOTRUNNING=0
51doPC ping || NOTRUNNING=$?
12c86877
BH
52
53case "$1" in
54 status)
55 if test "$NOTRUNNING" = "0"
56 then
57 doPC status
58 echo $ret
59 else
60 echo "not running"
f580d618 61 exit 3
12c86877
BH
62 fi
63 ;;
64
65 stop)
28c8ce25 66 echo -n "Stopping PowerDNS authoritative nameserver: "
12c86877
BH
67 if test "$NOTRUNNING" = "0"
68 then
69 doPC quit
70 echo $ret
71 else
72 echo "not running"
73 fi
74 ;;
75
6df4e8a0 76
12c86877 77 force-stop)
28c8ce25 78 echo -n "Stopping PowerDNS authoritative nameserver: "
12c86877 79 killall -v -9 pdns_server
eefd15f9 80 echo "killed"
12c86877
BH
81 ;;
82
83 start)
28c8ce25 84 echo -n "Starting PowerDNS authoritative nameserver: "
12c86877
BH
85 if test "$NOTRUNNING" = "0"
86 then
87 echo "already running"
88 else
190cca70 89 if $pdns_server --daemon --guardian=yes
12c86877
BH
90 then
91 echo "started"
f580d618
BH
92 else
93 echo "starting failed"
94 exit 1
12c86877
BH
95 fi
96 fi
97 ;;
98
99 force-reload | restart)
b014ad98 100 echo -n "Restarting PowerDNS authoritative nameserver: "
e7526caa
BH
101 if test "$NOTRUNNING" = "1"
102 then
103 echo "not running, starting"
104 else
105
106 echo -n stopping and waiting..
107 doPC quit
108 sleep 3
109 echo done
110 fi
12c86877
BH
111 $0 start
112 ;;
113
114 reload)
28c8ce25 115 echo -n "Reloading PowerDNS authoritative nameserver: "
12c86877
BH
116 if test "$NOTRUNNING" = "0"
117 then
118 doPC cycle
119 echo requested reload
120 else
121 echo not running yet
122 $0 start
123 fi
124 ;;
125
126 monitor)
127 if test "$NOTRUNNING" = "0"
128 then
129 echo "already running"
130 else
131 $pdns_server --daemon=no --guardian=no --control-console --loglevel=9
132 fi
133 ;;
134
135 dump)
136 if test "$NOTRUNNING" = "0"
137 then
138 doPC list
139 echo $ret
140 else
141 echo "not running"
142 fi
143 ;;
144
145 show)
146 if [ $# -lt 2 ]
147 then
148 echo Insufficient parameters
149 exit
150 fi
151 if test "$NOTRUNNING" = "0"
152 then
153 echo -n "$2="
154 doPC show $2 ; echo $ret
155 else
156 echo "not running"
157 fi
158 ;;
159
160 mrtg)
161 if [ $# -lt 2 ]
162 then
163 echo Insufficient parameters
164 exit
165 fi
166 if test "$NOTRUNNING" = "0"
167 then
168 doPC show $2 ; echo $ret
169 if [ "$3x" != "x" ]
170 then
171 doPC show $3 ; echo $ret
172 else
173 echo 0
174 fi
175 doPC uptime ; echo $ret
176 echo PowerDNS daemon
177 else
178 echo "not running"
179 fi
180
181 ;;
182
183 cricket)
184 if [ $# -lt 2 ]
185 then
186 echo Insufficient parameters
187 exit
188 fi
189 if test "$NOTRUNNING" = "0"
190 then
191 doPC show $2 ; echo $ret
192 else
193 echo "not running"
194 fi
195
196 ;;
197
198
199
200 *)
f22c75cd 201 echo pdns [start\|stop\|force-reload\|reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor]
12c86877
BH
202
203 ;;
204esac
205
206