File: unbound.init

package info (click to toggle)
unbound 1.6.0-2~bpo8+1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 20,444 kB
  • sloc: ansic: 79,862; sh: 5,040; yacc: 1,900; makefile: 1,315; python: 1,302; perl: 141
file content (87 lines) | stat: -rw-r--r-- 2,296 bytes parent folder | download | duplicates (3)
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
80
81
82
83
84
85
86
87
#!/bin/sh

### BEGIN INIT INFO
# Provides:          unbound
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO
# pidfile: /run/unbound.pid

NAME="unbound"
DESC="DNS server"
DAEMON="/usr/sbin/unbound"
PIDFILE="/run/unbound.pid"

HELPER="/usr/lib/unbound/package-helper"

test -x $DAEMON || exit 0

. /lib/lsb/init-functions

# Override this variable by editing or creating /etc/default/unbound.
DAEMON_OPTS=""

if [ -f /etc/default/unbound ]; then
    . /etc/default/unbound
fi

case "$1" in
    start)
        log_daemon_msg "Starting $DESC" "$NAME"
        $HELPER chroot_setup
        $HELPER root_trust_anchor_update 2>&1 | logger -p daemon.info -t unbound-anchor
        if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --name $NAME --startas $DAEMON -- $DAEMON_OPTS; then
            $HELPER resolvconf_start
            log_end_msg 0
        else
            log_end_msg 1
        fi
        ;;

    stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
        if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name $NAME --retry 5; then
            $HELPER resolvconf_stop
            log_end_msg 0
        else
            log_end_msg 1
        fi
        ;;

    restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME --retry 5
        $HELPER resolvconf_stop
        if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --name $NAME --startas $DAEMON -- $DAEMON_OPTS; then
            $HELPER chroot_setup
            $HELPER resolvconf_start
            log_end_msg 0
        else
            log_end_msg 1
        fi
        ;;

    reload)
        log_daemon_msg "Reloading $DESC" "$NAME"
        if start-stop-daemon --stop --pidfile $PIDFILE --signal 1; then
            $HELPER chroot_setup
            log_end_msg 0
        else
            log_end_msg 1
        fi
        ;;

    status)
        status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
        ;;

    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|status|reload|force-reload}" >&2
        exit 1
        ;;
esac

exit 0