#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DCBD_BIN=/usr/sbin/dcbd
DCBD_PID=/var/run/dcbd.pid

depend() {
	after modules
	before net
}

start() {
	if ! /bin/lsmod | grep dcbnl > /dev/null; then
		mod_dir="/lib/modules/$(uname -r)/kernel/net/dcb"
		if [ -f $mod_dir/dcbnl.ko ]; then
			modprobe dcbnl > /dev/null 2>&1
		fi
	fi
	ebegin "Starting dcbd"
	start-stop-daemon --start --quiet --background --make-pidfile --pidfile ${DCBD_PID} --exec ${DCBD_BIN}
	eend $?
}

stop() {
	ebegin "Stopping dcbd"
	start-stop-daemon --stop --quiet --pidfile ${DCBD_PID}
	eend $?
}
