summaryrefslogtreecommitdiff
blob: 460a64da34a4e9d43372ea1ec7d1d022c87930d8 (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
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/quagga-services.init,v 1.2 2010/10/12 11:42:55 flameeyes Exp $

depend() {
    need zebra
    # this could be config file-dependent on OpenRC, but for now it
    # will do.
    use logger
}

start() {
    if [ ! -e /etc/quagga/${SVCNAME}.conf ] ; then
        eerror "Before starting ${SVCNAME} you have to configure it, by creating"
        eerror "a /etc/quagga/${SVCNAME}.conf file."
        eerror ""
        eerror "A sample file has been installed in `ls /usr/share/doc/quagga-*/samples/${SVCNAME}.conf.sample`"
        return 1
    fi

    if [ ! -d /var/run/quagga ] ; then
        mkdir -p /var/run/quagga
        chown quagga:quagga /var/run/quagga
        chmod 0750 /var/run/quagga
    fi

    ebegin "Starting ${SVCNAME}"
    start-stop-daemon \
        --start --exec /usr/sbin/${SVCNAME} \
        --pidfile /var/run/quagga/${SVCNAME}.pid \
	-- -d -f /etc/quagga/${SVCNAME}.conf ${EXTRA_OPTS} \
	--pid_file /var/run/quagga/${SVCNAME}.pid

    eend $?
}

stop() {
    ebegin "Stopping ${SVCNAME}"
    start-stop-daemon --stop \
        --pidfile /var/run/quagga/${SVCNAME}.pid
    eend $?
}