Subversion Repositories configs

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/sh
2
#
3
# Startup script for the DNS caching server
4
#
5
# chkconfig: - 49 50
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
DOMAIN_SUFFIX=`dnsdomainname`
23
if [ ! -z "${DOMAIN_SUFFIX}" ]; then
24
  OPTIONS="-s $DOMAIN_SUFFIX"
25
fi
26
 
27
RETVAL=0
28
 
11 - 29
PIDFILE="/var/run/dnsmasq.pid"
30
 
4 - 31
# See how we were called.
32
case "$1" in
33
  start)
34
        if [ $UID -ne 0 ] ; then
35
            echo "User has insufficient privilege."
36
            exit 4
37
        fi
38
        echo -n "Starting dnsmasq: "
39
        daemon $dnsmasq $OPTIONS
40
	RETVAL=$?
41
        echo
42
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
43
        ;;
44
  stop)
45
        if test "x`pidfileofproc dnsmasq`" != x; then
46
            echo -n "Shutting down dnsmasq: "
47
            killproc dnsmasq
48
        fi
49
	RETVAL=$?
50
        echo
11 - 51
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq $PIDFILE
4 - 52
        ;;
53
  status)
11 - 54
	status -p $PIDFILE dnsmasq
4 - 55
	RETVAL=$?
56
	;;
57
  reload)
58
	if test "x`pidfileofproc dnsmasq`" != x; then
59
		echo -n "Reloading dnsmasq: "
60
		killproc dnsmasq -HUP
61
	fi
62
	RETVAL=$?
63
	echo
64
	;;
65
  force-reload)
66
        # new configuration takes effect only after restart
67
	$0 stop
68
	$0 start
69
	RETVAL=$?
70
        ;;
71
  restart)
72
	$0 stop
73
	$0 start
74
	RETVAL=$?
75
	;;
76
  condrestart)
77
	    if test "x`pidfileofproc dnsmasq`" != x; then
78
		$0 stop
79
		$0 start
80
		RETVAL=$?
81
	    fi
82
	    ;;
83
  *)
84
        echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
85
        exit 2
86
esac
87
 
88
exit $RETVAL
89