gentoo-overlay/net-misc/quagga/files/zebra.init.3

55 lines
1.4 KiB
Groff

#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/zebra.init.3,v 1.2 2011/09/27 21:50:12 flameeyes Exp $
: ${CFGFILE:=/etc/quagga/${SVCNAME}.conf}
get_service_config() {
awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE"
}
depend() {
config "$CFGFILE"
need net
[ "$(get_service_config log)" = "syslog" ] && \
use logger
}
start() {
if [ ! -e "${CFGFILE}" ] ; then
eerror "Before starting ${SVCNAME} you have to configure it, by creating"
eerror "a ${CFGFILE} 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 "Cleaning up stale zebra routes..."
ip route flush proto zebra
eend $?
ebegin "Starting ${SVCNAME}"
start-stop-daemon \
--start --exec /usr/sbin/${SVCNAME} \
--pidfile /var/run/quagga/${SVCNAME}.pid \
-- -d -f "${CFGFILE}" ${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 $?
}