blob: 6318204f437c36f48f7d5b04b7fb4c38b406ccc7 (
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
|
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/nsd/files/nsd.initd,v 1.2 2013/04/03 19:10:39 wschlich Exp $
name="NSD"
description="NSD is an authoritative-only, high performance, open source name server"
extra_commands="configtest"
# these can be overridden in /etc/conf.d/nsd if necessary
NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}"
command="${NSD_BINARY:-/usr/sbin/nsd}"
NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}"
command_args="-c ${NSD_CONFIG}"
depend() {
need net
use logger
}
configtest() {
ebegin "Checking ${SVCNAME} configuration"
checkconfig
eend $?
}
checkconfig() {
if ! test -e "${NSD_CONFIG}"; then
eerror "You need to create an appropriate config file."
eerror "An example can be found in /etc/nsd/nsd.conf.sample"
return 1
elif ! "${NSD_CHECKCONF}" "${NSD_CONFIG}"; then
eerror "You have errors in your configfile (${NSD_CONFIG})"
return $?
fi
return 0
}
start_pre() {
checkconfig || return $?
pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
checkpath --directory --owner nsd:nsd "${pidfile%/*}"
}
stop_pre() {
checkconfig || return $?
pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
}
|