#!/bin/sh
#
# olc:	Start the Athena olc services.
#
# chkconfig: 345 80 30
# description: OLC startup.
# processname: olcd rpd
# pidfile: /var/athena/olcd.pid
# pidfile: /var/athena/rpd.pid
# config: /etc/sysconfig/network

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

. /etc/sysconfig/network
. /etc/athena/rc.conf

PATH=/etc/athena:/bin/athena:/usr/athena/bin:$PATH

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -f /etc/athena/xntpd ] || exit 0

[ "$OLC" = true ] || exit 0

RETVAL=0

# See how we were called
case "$1" in
  start)
	echo -n "Starting Athena olc services: "
	daemon olcd && daemon rpd
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/olc
	;;

  stop)
	echo -n "Stopping Athena olc services: "
	killproc rpd &&	killproc olcd
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/olc
	;;

  status)
	status rpd && status olcd
	RETVAL=$?
	;;

  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;

  reload)
	killall -HUP olcd && killall -HUP rpd
	RETVAL=$?
	;;

  *)
	echo "Usage: olc {start|stop|status|restart|reload}"
	exit 1
esac

exit $RETVAL
