~cyphermox/ubuntu/precise/dnsmasq/dbus

« back to all changes in this revision

Viewing changes to rpm/dnsmasq.rh

  • Committer: Bazaar Package Importer
  • Author(s): Simon Kelley
  • Date: 2005-05-04 13:25:23 UTC
  • mfrom: (0.2.1 upstream) (1.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050504132523-29x9nzdnkypp62nc
Tags: 2.22-2
Make the resolv.conf polling code resistant to 
backwards-moving system clocks. (closes: #306117) (closes: #300694)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Startup script for the DNS caching server
 
4
#
 
5
# chkconfig: 2345 99 01
 
6
# description: This script starts your DNS caching server
 
7
# processname: dnsmasq
 
8
# pidfile: /var/run/dnsmasq.pid
 
9
 
 
10
# Source function library.
 
11
. /etc/rc.d/init.d/functions
 
12
 
 
13
# Source networking configuration.
 
14
. /etc/sysconfig/network
 
15
 
 
16
# Check that networking is up.
 
17
[ ${NETWORKING} = "no" ] && exit 0
 
18
 
 
19
dnsmasq=/usr/sbin/dnsmasq
 
20
[ -f $dnsmasq ] || exit 0
 
21
 
 
22
# change this line if you want dnsmasq to serve an MX record for 
 
23
# the host it is running on. 
 
24
MAILHOSTNAME=""
 
25
# change this line if you want dns to get its upstream servers from
 
26
# somewhere other that /etc/resolv.conf 
 
27
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`
 
32
 
 
33
OPTIONS=""
 
34
 
 
35
if [ ! -z "${MAILHOSTNAME}" ]; then
 
36
  OPTIONS="$OPTIONS -m $MAILHOSTNAME"
 
37
fi
 
38
 
 
39
if [ ! -z "${RESOLV_CONF}" ]; then
 
40
  OPTIONS="$OPTIONS -r $RESOLV_CONF"
 
41
fi
 
42
 
 
43
if [ ! -z "${DHCP_LEASE}" ]; then
 
44
  OPTIONS="$OPTIONS -l $DHCP_LEASE"
 
45
fi
 
46
 
 
47
if [ ! -z "${DOMAIN_SUFFIX}" ]; then
 
48
  OPTIONS="$OPTIONS -s $DOMAIN_SUFFIX"
 
49
fi
 
50
 
 
51
RETVAL=0
 
52
 
 
53
# See how we were called.
 
54
case "$1" in
 
55
  start)
 
56
        echo -n "Starting dnsmasq: "
 
57
        daemon $dnsmasq $OPTIONS
 
58
        RETVAL=$?
 
59
        echo
 
60
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
 
61
        ;;
 
62
  stop)
 
63
        if test "x`pidof dnsmasq`" != x; then
 
64
            echo -n "Shutting down dnsmasq: "
 
65
            killproc dnsmasq
 
66
        fi
 
67
        RETVAL=$?
 
68
        echo
 
69
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid
 
70
        ;;
 
71
  status)
 
72
        status dnsmasq
 
73
        RETVAL=$?
 
74
        ;;
 
75
  restart|reload)
 
76
        $0 stop
 
77
        $0 start
 
78
        RETVAL=$?
 
79
        ;;
 
80
  condrestart)
 
81
            if test "x`/sbin/pidof dnsmasq`" != x; then
 
82
                $0 stop
 
83
                $0 start
 
84
                RETVAL=$?
 
85
            fi
 
86
            ;;
 
87
  *)
 
88
        echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
 
89
        exit 1
 
90
esac
 
91
 
 
92
exit $RETVAL
 
93