summaryrefslogtreecommitdiff
blob: 6295e018e59873b854bb06e029f2a74236f3c9c0 (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
52
53
54
55
56
57
#!/sbin/runscript 
# Copyright 1999-2008 Gentoo Foundation 
# Distributed under the terms of the GNU General Public License v2 
# $Header: $ 
#
opts="${opts} reload configtest"
description="NSD is an authoritative only, high performance, open source name server"
description_start="Start the server"
description_stop="Stop the server"
description_configtest="Check the syntax of the configuration file"
description_reload="Reload the database file"

CONTROL="/usr/sbin/nsdc"

depend() { 
	need net 
	use logger 
	provide auth-dns
} 

configtest() {
	ebegin "Checking config"
		if [ ! -e "/etc/nsd/nsd.conf" ]; then
			eerror "You need to create an appropriate config file"
			eerror "in /etc/nsd/ . An example can be found in /etc/nsd/nsd.conf.sample"
			return 1
		fi

		if ! nsd-checkconf "/etc/nsd/nsd.conf"; then
			eerror "You have errors in your configfile"
			return 1
		fi
	eend
}

start() { 
	configtest || return 1

	ebegin "Starting NSD"
		${CONTROL} start
		${CONTROL} running
	eend $? 
}

stop() { 
	ebegin "Stopping NSD"
		${CONTROL} patch
		${CONTROL} stop
	eend $? 
} 

reload() {
	configtest || return 1
	ebegin "Reloading NSD"
		${CONTROL} reload
	eend $? 
}