Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
1212 crox53 1
#!/bin/sh
2
#
3
# Startup script for the DNS caching server
4
 
5
### BEGIN INIT INFO
6
# Provides: dnsmasq $named
7
# Required-Start: $network
8
# Required-Stop: $network
9
# Default-Start: 3 4 5
10
# Short-Description: a dhcp/dns server.
11
# Description: dnsmasq is a dhcp and dns server.
12
#              It aims to be used on small networks where people do not need the complexity of bind.
13
### END INIT INFO
14
 
15
#
16
# chkconfig: 2345 99 40
17
# description: This script starts your DNS caching server
18
# processname: dnsmasq
19
# pidfile: /var/run/dnsmasq.pid
20
#
21
 
22
# Source function library.
23
. /etc/rc.d/init.d/functions
24
 
25
# Source networking configuration.
26
. /etc/sysconfig/network
27
 
28
# Check that networking is up.
29
[ ${NETWORKING} = "no" ] && exit 0
30
 
31
dnsmasq=/usr/sbin/dnsmasq
32
[ -f $dnsmasq ] || exit 0
33
 
34
# change this line if you want dnsmasq to serve an MX record for 
35
# the host it is running on. 
36
MAILHOSTNAME=""
37
# change this line if you want dns to get its upstream servers from
38
# somewhere other that /etc/resolv.conf 
39
RESOLV_CONF=""
40
# change this if you want dnsmasq to cache any "hostname" or "client-hostname" from
41
# a dhcpd's lease file
42
DHCP_LEASE="/var/lib/dhcp/dhcpd.leases"
43
DOMAIN_SUFFIX=`dnsdomainname`
44
alcasar_conf_file="/usr/local/etc/alcasar.conf"
45
DNS_FILTERING=`grep DNS_FILTERING= $alcasar_conf_file|cut -d"=" -f2`		# DNS and URLs filter (on/off)
46
DNS_FILTERING=${DNS_FILTERING:=off}
47
 
48
DAEMON_NAME=dnsmasq
49
[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME
50
 
51
 
52
if [ ! -z "${MAILHOSTNAME}" ]; then
53
  OPTIONS="$OPTIONS -m $MAILHOSTNAME"
54
fi
55
 
56
if [ ! -z "${RESOLV_CONF}" ]; then
57
  OPTIONS="$OPTIONS -r $RESOLV_CONF"
58
fi
59
 
60
if [ ! -z "${DHCP_LEASE}" ]; then
61
  OPTIONS="$OPTIONS -l $DHCP_LEASE"
62
fi
63
 
64
if [ ! -z "${DOMAIN_SUFFIX}" ]; then
65
  OPTIONS="$OPTIONS -s $DOMAIN_SUFFIX"
66
fi
67
 
68
 
69
case "$1" in
70
  start)
71
        gprintf "Starting %s: " $DAEMON_NAME
72
        daemon $dnsmasq $OPTIONS
73
	if [ $DNS_FILTERING = on ]; then
74
		$dnsmasq -C /etc/dnsmasq-blackhole.conf $OPTIONS
75
	fi
76
        echo
77
        touch /var/lock/subsys/$DAEMON_NAME
78
        ;;
79
  stop)
80
        gprintf "Shutting down %s: " $DAEMON_NAME
81
        killproc $DAEMON_NAME
82
killproc $DAEMON_NAME
83
        echo
84
        rm -f /var/lock/subsys/$DAEMON_NAME
85
        ;;
86
  status)
87
    	status dnsmasq
88
        ;;
89
  restart|reload)
90
        $0 stop
91
        $0 start
92
        ;;
93
  *)
94
        gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0"
95
        exit 1
96
esac
97
 
98