summaryrefslogtreecommitdiff
path: root/debian/lwresd.init
blob: 179508615aeac4fc64f0d98a967df2227f4f0936 (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
#!/bin/sh

### BEGIN INIT INFO
# Provides:          lwresd
# Required-Start:    $remote_fs
# Should-Start:	     $syslog $network
# Required-Stop:     $remote_fs
# Should-Stop:	     $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop the Lightweight Resolver Daemon.
### END INIT INFO

. /lib/lsb/init-functions

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=lwresd
DAEMON=/usr/sbin/lwresd
PIDFILE=/var/run/lwresd/lwresd.pid

# Don't modify this line, change or create /etc/default/lwresd.
OPTIONS=""

test -f /etc/default/lwresd && . /etc/default/lwresd

test -x $DAEMON || exit 0

case "$1" in
    start)
	modprobe capability >/dev/null 2>&1 || true

	# dirs under /var/run can go away on reboots.
	mkdir -p ${PIDFILE%/*}
	chmod 775 ${PIDFILE%/*}
	chown root:bind ${PIDFILE%/*} >/dev/null 2>&1 || true

	log_daemon_msg "Starting domain name service" $NAME
	if start-stop-daemon --start --quiet --exec $DAEMON  -- $OPTIONS; then
	    log_end_msg 0
	else
	    log_end_msg 1
	fi
    ;;

    stop)
	log_daemon_msg "Stopping domain name service" $NAME
	if start-stop-daemon --stop --quiet  \
	    --pidfile ${PIDFILE} --exec $DAEMON; then
	    log_end_msg 0
	else
	    log_end_msg 1
	fi
    ;;

    status)
	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
    ;;


    restart|force-reload)
	$0 stop
	sleep 2
	$0 start
    ;;
    
    *)
	log_action_msg "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}"
	exit 1
    ;;
esac

exit 0