Subversion Repositories configs

Rev

Go to most recent revision | Details | 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
 
29
# See how we were called.
30
case "$1" in
31
  start)
32
        if [ $UID -ne 0 ] ; then
33
            echo "User has insufficient privilege."
34
            exit 4
35
        fi
36
        echo -n "Starting dnsmasq: "
37
        daemon $dnsmasq $OPTIONS
38
	RETVAL=$?
39
        echo
40
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsmasq
41
        ;;
42
  stop)
43
        if test "x`pidfileofproc dnsmasq`" != x; then
44
            echo -n "Shutting down dnsmasq: "
45
            killproc dnsmasq
46
        fi
47
	RETVAL=$?
48
        echo
49
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq /var/run/dnsmasq.pid
50
        ;;
51
  status)
52
	status dnsmasq
53
	RETVAL=$?
54
	;;
55
  reload)
56
	if test "x`pidfileofproc dnsmasq`" != x; then
57
		echo -n "Reloading dnsmasq: "
58
		killproc dnsmasq -HUP
59
	fi
60
	RETVAL=$?
61
	echo
62
	;;
63
  force-reload)
64
        # new configuration takes effect only after restart
65
	$0 stop
66
	$0 start
67
	RETVAL=$?
68
        ;;
69
  restart)
70
	$0 stop
71
	$0 start
72
	RETVAL=$?
73
	;;
74
  condrestart)
75
	    if test "x`pidfileofproc dnsmasq`" != x; then
76
		$0 stop
77
		$0 start
78
		RETVAL=$?
79
	    fi
80
	    ;;
81
  *)
82
        echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
83
        exit 2
84
esac
85
 
86
exit $RETVAL
87