summaryrefslogtreecommitdiffstats
path: root/contrib/Suse/rc.dnsmasq-suse
blob: 71f4c7277cfa462be36e6a6b640e2e1855102ec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /bin/sh
#
# init.d/dnsmasq
#
### BEGIN INIT INFO
# Provides:       dnsmasq
# Required-Start: $network $remote_fs $syslog
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    Starts internet name service masq caching server (DNS)
### END INIT INFO

NAMED_BIN=/usr/sbin/dnsmasq
NAMED_PID=/var/run/dnsmasq.pid
NAMED_CONF=/etc/dnsmasq.conf

if [ ! -x $NAMED_BIN ] ; then
	echo -n "dnsmasq not installed ! "
	exit 5
fi

. /etc/rc.status
rc_reset

case "$1" in
    start)
	echo -n "Starting name service masq caching server "
        checkproc -p $NAMED_PID $NAMED_BIN
        if [ $? -eq 0 ] ; then
           echo -n "- Warning: dnsmasq already running ! "
        else
           [ -e $NAMED_PID ] && echo -n "- Warning: $NAMED_PID exists ! "
	fi
	startproc -p $NAMED_PID $NAMED_BIN -u nobody
	rc_status -v
	;;
    stop)
	echo -n "Shutting name service masq caching server "
	checkproc -p $NAMED_PID $NAMED_BIN
	[ $? -ne 0 ] && echo -n "- Warning: dnsmasq not running ! "
	killproc -p $NAMED_PID -TERM $NAMED_BIN
	rc_status -v
	;;
    try-restart)
	$0 stop  &&  $0 start
	rc_status
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	$0 reload
	rc_status
	;;
    reload)
	echo -n "Reloading name service masq caching server "
	checkproc -p $NAMED_PID $NAMED_BIN
	[ $? -ne 0 ] && echo -n "- Warning: dnsmasq not running ! "
	killproc -p $NAMED_PID -HUP $NAMED_BIN
	rc_status -v
	;;
    status)
	echo -n "Checking for name service masq caching server "
	checkproc -p $NAMED_PID $NAMED_BIN
	rc_status -v
	;;
    probe)
	test $NAMED_CONF -nt $NAMED_PID && echo reload
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit