#!/bin/sh
#
# auth2
#
# chkconfig:	345 95 01
#
# description:	The Coda authentication server
#

# 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 auth2
		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/auth2 ]; then
		msg_starting auth2
		daemon auth2
		RETVAL=$?
		[ RETVAL -eq 0 ] && touch /var/lock/subsys/auth2
	else
		msg_already_running auth2
	fi
	;;
  stop)
	if [ -f /var/lock/subsys/auth2 ]; then
		msg_stopping auth2
		killproc auth2
		rm -f /var/lock/subsys/auth2
	else
		msg_not_running auth2
	fi
	;;
  status)
	status auth2
	exit $?
	;;
  restart|force-reload)
	$0 stop
	$0 start
	exit $?
	;;
  *)
	msg_usage "$0 {start|stop|restart|force-reload|status}"
	exit 3
	;;
esac

exit $RETVAL
