#!/bin/sh
#
#    This shell script takes care of starting and stopping
#			Tacacs+ Daemon 
#

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

# Source networking configuration.
. /etc/sysconfig/network

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

[ -f /usr/local/sbin/tac_plus ] || exit 0

[ -f /etc/tacacs/tac_plus.cfg ] || exit 0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting tacacs+: "
	/usr/local/sbin/tac_plus -C /etc/tacacs/tac_plus.cfg
        echo
        touch /var/lock/subsys/tacacs
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down tacacs+: "
        killproc tac_plus
        rm -f /var/lock/subsys/tacacs
        echo
        ;;
  status)
	status tac_plus	
	exit $?
	;;
  restart)
	$0 stop
	$0 start
	exit $?
	;;
  *)
        echo "Usage: tacacs {start|stop|status|restart}"
        exit 1
esac

exit 0
