#!/bin/sh
#
# venus
#
# chkconfig:	345 97 01
#
# description:	The Coda cache manager
#

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

# Get network config
. /etc/sysconfig/network

# Check that networking is up
if is_yes "${NETWORKING}"; then
	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
		msg_network_down Venus
		exit 1
	fi
else
	exit 0
fi

RETVAL=0
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/venus ]; then
		msg_starting venus
		busy
		venus &
		RETVAL=$?
		ok
		[ RETVAL -eq 0 ] && touch /var/lock/subsys/venus
	else
		msg_already_running venus
	fi
	;;
  stop)
	if [ -f /var/lock/subsys/venus ]; then
		msg_stopping venus
		killproc venus
		umount /coda
		rm -f /var/lock/subsys/venus
	else
		msg_not_running venus
	fi
	;;
  status)
	;;
  restart|force-reload)
	$0 stop
	$0 start
	exit $?
	;;
  *)
	msg_usage "$0 {start|stop|restart|force-reload|status}"
	exit 3
esac

exit $RETVAL
