]> Pileus Git - ~andy/sunrise/blob - net-dns/nsd/files/nsd.initd
Version bump
[~andy/sunrise] / net-dns / nsd / files / nsd.initd
1 #!/sbin/runscript 
2 # Copyright 1999-2008 Gentoo Foundation 
3 # Distributed under the terms of the GNU General Public License v2 
4 # $Header: $ 
5 #
6 opts="${opts} reload configtest"
7 description="NSD is an authoritative only, high performance, open source name server"
8 description_start="Start the server"
9 description_stop="Stop the server"
10 description_configtest="Check the syntax of the configuration file"
11 description_reload="Reload the database file"
12
13 CONTROL="/usr/sbin/nsdc"
14
15 depend() { 
16         need net 
17         use logger 
18         provide auth-dns
19
20
21 configtest() {
22         ebegin "Checking config"
23                 if [ ! -e "/etc/nsd/nsd.conf" ]; then
24                         eerror "You need to create an appropriate config file"
25                         eerror "in /etc/nsd/ . An example can be found in /etc/nsd/nsd.conf.sample"
26                         return 1
27                 fi
28
29                 if ! nsd-checkconf "/etc/nsd/nsd.conf"; then
30                         eerror "You have errors in your configfile"
31                         return 1
32                 fi
33         eend
34 }
35
36 start() { 
37         configtest || return 1
38
39         ebegin "Starting NSD"
40                 ${CONTROL} start
41                 ${CONTROL} running
42         eend $? 
43 }
44
45 stop() { 
46         ebegin "Stopping NSD"
47                 ${CONTROL} patch
48                 ${CONTROL} stop
49         eend $? 
50
51
52 reload() {
53         configtest || return 1
54         ebegin "Reloading NSD"
55                 ${CONTROL} reload
56         eend $? 
57 }