#!/sbin/runscript # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-p2p/btg/files/btgd-init,v 1.3 2007/11/28 17:30:53 angelos Exp $ depend() { need net } checkconfig() { if [ -z ${BTG_USER} ]; then eerror "BTG_USER unset, please edit /etc/conf.d/btgd first" return 1 elif [ -z ${BTG_CONFIG_FILE} ]; then eerror "BTG_CONFIG_FILE unset, please edit /etc/conf.d/btgd first" return 1 elif [ ! -f "${BTG_CONFIG_FILE}" ]; then eerror "Unable to find the configuration file ${BTG_CONFIG_FILE}" eerror "Please run btg-config first" return 1 fi } start() { ebegin "Starting BTG Daemon" checkconfig || return 1 start-stop-daemon --start \ -c ${BTG_USER} --quiet -b --make-pidfile \ --pidfile /var/run/btgdaemon.pid \ -x /usr/bin/btgdaemon -- -n -c ${BTG_CONFIG_FILE} eend $? } stop() { ebegin "Stopping BTG Daemon" start-stop-daemon --stop --quiet --pidfile /var/run/btgdaemon.pid eend $? }