You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

#!/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/quagga-services.init.2,v 1.3 2011/09/27 21:51:34 flameeyes Exp $
: ${CFGFILE:=/etc/quagga/${SVCNAME}.conf}
get_service_config() {
[ -e "$CFGFILE" ] || return
awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE"
}
depend() {
config "$CFGFILE"
need zebra
[ "$(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 "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 $?
}