#! /bin/bash
#
# bb           Start/Stop the Big Brother system.
#
# chkconfig: 345 10 99
#

# Source function library.
. /etc/init.d/functions

RETVAL=0
RUNBB="/wherever/your/bb/is/runbb.sh"

# See how we were called.
  
prog="Big Brother"

start() {
	su - -c "$RUNBB start" bb
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bb
	return $RETVAL
}

stop() {
	su - -c "$RUNBB stop" bb
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bb
	return $RETVAL
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  *)
	echo $"Usage: $0 {start|stop}"
	exit 1
esac

exit $?
