blob: 2fe583fcf9e1c066b5d37b58ead7edf521c64bea [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001#!/bin/sh
2#
3# Startup script for dnrd
4#
5# Copyright 2008, Rakesh Pandit <rakesh.pandit@gmail.com>
6#
7# This source is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2, or (at your option)
10# any later version.
11
12# This source is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20#
21# chkconfig: - 85 15
22# description: dnrd is a proxying nameserver. It forwards DNS queries to the
23# appropriate nameserver, but can also act as the primary nameserver for
24# a subnet behind a firewall. It also has features such as caching DNS
25# requests, support for DNS servers, cache poisoning prevention, TCP
26# support, etc..
27
28# processname: dnrd
29# pidfile: /var/run/dnrd.pid
30# config: /etc/dnrd/dnrd.conf
31
32# Provides: dnrd
33# Required-Start:
34# Should-Start:
35# Required-Stop:
36# Default-Stop: 0 1 2 6
37# Short-Description: Start dnrd daemon
38# Description: Domain Name Relay Daemon
39# END INIT INFO
40
41exe=/usr/sbin/dnrd
42pfile=/etc/passwd
43
44# Source function library.
45. /etc/init.d/functions
46
47# Source conf file
48. /etc/dnrd/dnrd.conf
49
50[ -x $exe ] || exit 1
51[ -r "/etc/dnrd/dnrd.conf" ] || exit 1
52if [ $DNRD_USER ]
53then
54 grep "^${LOGIN}:" $pfile >/dev/null 2>&1
55 if [ $? -eq 0 ];then
56 echo "$DNRD_USER specified in /etc/dnrd/dnrd.conf does not exist!"
57 fi
58else
59 echo "DNRD_USER not set at /etc/dnrd/dnrd.conf!"
60 exit 1
61fi
62
63case "$1" in
64 start)
65 echo -n "Starting dnrd: "
66 daemon dnrd $DNRD_OPTS -u $DNRD_USER
67 echo
68 touch /var/lock/subsys/dnrd
69 ;;
70 stop)
71 echo -n "Shutting down dnrd: "
72 killproc dnrd
73 echo
74 rm -f /var/lock/subsys/dnrd
75 rm -f /var/run/dnrd.pid
76 ;;
77 status)
78 status dnrd
79 ;;
80 restart)
81 $0 stop
82 $0 start
83 ;;
84 reload)
85 echo -n "Reloading dnrd: "
86 killproc dnrd -HUP
87 echo
88 ;;
89 *)
90 echo "Usage: $0 {start|stop|restart|reload|status}"
91 exit 1
92esac
93
94exit 0