#!/bin/sh
#
# radiusd	Start/Stop Radius daemon.
#
# chkconfig: 345 98 10
#
# description:	Remote Authentication Dail In User Service
#

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# NLS
NLS_DOMAIN="rc-scripts"

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

. /etc/sysconfig/network

# Check that networking is up.
is_no "${NETWORKING}" && exit 0

RETVAL=0

case "$1" in
  start)
  	if [ ! -f /var/lock/subsys/radius ]; then
	    msg_starting "Radius-Cistron Server"
	    daemon radiusd -y
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/radius
	else
	    msg_already_running "Radius-Cistron Server"
	    RETVAL=1
	fi
	;;
  stop)
  	if [ -f /var/lock/subsys/radius ]; then
	    msg_stopping "Radius-Cistron Server"
	    killproc radiusd
	    rm -f /var/lock/subsys/radius >/dev/null 2>&1
	else
	    msg_not_running "Radius-Cistron Server"
	    RETVAL=1
	fi
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $RETVAL
