#!/sbin/runscript
#
# (c) 2003 Juan J. Prieto <jjptapia@eresmas.com>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# ===
#
# htbinit
# 
# A shell-script wrapper for HTB.INIT designed for
# use in the SysV-init system (/etc/init.d).
#
# usage: htbinit { start | clear | reload | recreate | stats }
#
opts="start clear reload recreate stats"

depend() {
	need net
}

start() {
	ebegin "Starting htbinit"
	/usr/sbin/htbinit start
	eend $?
}

clear() {
	ebegin "Stopping htbinit"
	/usr/sbin/htbinit stop
	eend $?
}

reload() {
	ebegin "Reloading htbinit"
	/usr/sbin/htbinit start invalidate
	eend $?
}

recreate() {
	ebegin "Recreating htbinit config files"
	/bin/rm -rf /etc/htbinit/*
	/usr/sbin/htb.sysconfig
	einfo "htbinit (QoS) ... recreated. Use \"reload\" to load the new configuration."
	eend $?
}

stats() {
	ebegin "Showing htbinit stats"
	/usr/sbin/htbinit stats
	eend $?
}
