Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1211 → Rev 1212

/conf/dnsmasq
0,0 → 1,98
#!/bin/sh
#
# Startup script for the DNS caching server
 
### BEGIN INIT INFO
# Provides: dnsmasq $named
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: a dhcp/dns server.
# Description: dnsmasq is a dhcp and dns server.
# It aims to be used on small networks where people do not need the complexity of bind.
### END INIT INFO
 
#
# chkconfig: 2345 99 40
# description: This script starts your DNS caching server
# processname: dnsmasq
# pidfile: /var/run/dnsmasq.pid
#
 
# Source function library.
. /etc/rc.d/init.d/functions
 
# Source networking configuration.
. /etc/sysconfig/network
 
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
 
dnsmasq=/usr/sbin/dnsmasq
[ -f $dnsmasq ] || exit 0
 
# change this line if you want dnsmasq to serve an MX record for
# the host it is running on.
MAILHOSTNAME=""
# change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
RESOLV_CONF=""
# change this if you want dnsmasq to cache any "hostname" or "client-hostname" from
# a dhcpd's lease file
DHCP_LEASE="/var/lib/dhcp/dhcpd.leases"
DOMAIN_SUFFIX=`dnsdomainname`
alcasar_conf_file="/usr/local/etc/alcasar.conf"
DNS_FILTERING=`grep DNS_FILTERING= $alcasar_conf_file|cut -d"=" -f2` # DNS and URLs filter (on/off)
DNS_FILTERING=${DNS_FILTERING:=off}
 
DAEMON_NAME=dnsmasq
[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME
 
 
if [ ! -z "${MAILHOSTNAME}" ]; then
OPTIONS="$OPTIONS -m $MAILHOSTNAME"
fi
 
if [ ! -z "${RESOLV_CONF}" ]; then
OPTIONS="$OPTIONS -r $RESOLV_CONF"
fi
 
if [ ! -z "${DHCP_LEASE}" ]; then
OPTIONS="$OPTIONS -l $DHCP_LEASE"
fi
 
if [ ! -z "${DOMAIN_SUFFIX}" ]; then
OPTIONS="$OPTIONS -s $DOMAIN_SUFFIX"
fi
 
 
case "$1" in
start)
gprintf "Starting %s: " $DAEMON_NAME
daemon $dnsmasq $OPTIONS
if [ $DNS_FILTERING = on ]; then
$dnsmasq -C /etc/dnsmasq-blackhole.conf $OPTIONS
fi
echo
touch /var/lock/subsys/$DAEMON_NAME
;;
stop)
gprintf "Shutting down %s: " $DAEMON_NAME
killproc $DAEMON_NAME
killproc $DAEMON_NAME
echo
rm -f /var/lock/subsys/$DAEMON_NAME
;;
status)
status dnsmasq
;;
restart|reload)
$0 stop
$0 start
;;
*)
gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0"
exit 1
esac