3
# Startup script for the DNS caching server
5
# chkconfig: 2345 99 01
6
# description: This script starts your DNS caching server
8
# pidfile: /var/run/dnsmasq.pid
10
# Source function library.
11
. /etc/rc.d/init.d/functions
13
# Source networking configuration.
14
. /etc/sysconfig/network
16
# Check that networking is up.
17
[ ${NETWORKING} = "no" ] && exit 0
19
dnsmasq=/usr/sbin/dnsmasq
20
[ -f $dnsmasq ] || exit 0
22
# change this line if you want dnsmasq to serve an MX record for
23
# the host it is running on.
25
# change this line if you want dns to get its upstream servers from
26
# somewhere other that /etc/resolv.conf
28
# change this if you want dnsmasq to cache any "hostname" or "client-hostname" from
29
# a dhcpd's lease file
30
DHCP_LEASE="/var/lib/dhcp/dhcpd.leases"
31
DOMAIN_SUFFIX=`dnsdomainname`
35
if [ ! -z "${MAILHOSTNAME}" ]; then
36
OPTIONS="$OPTIONS -m $MAILHOSTNAME"
39
if [ ! -z "${RESOLV_CONF}" ]; then
40
OPTIONS="$OPTIONS -r $RESOLV_CONF"
43
if [ ! -z "${DHCP_LEASE}" ]; then
44
OPTIONS="$OPTIONS -l $DHCP_LEASE"
47
if [ ! -z "${DOMAIN_SUFFIX}" ]; then
48
OPTIONS="$OPTIONS -s $DOMAIN_SUFFIX"
53
# See how we were called.
56
echo -n "Starting dnsmasq: "
57
daemon $dnsmasq $OPTIONS
60
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
63
if test "x`pidof dnsmasq`" != x; then
64
echo -n "Shutting down dnsmasq: "
69
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid
81
if test "x`/sbin/pidof dnsmasq`" != x; then
88
echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"