#! /bin/sh
#
# radiusd	Init script for FreeRADIUS server
#
# chkconfig: - 90 10
# description:	FreeRADIUS server is an RFC2138 compliant RADIUS authentication
#		and accounting server.
# processname: radiusd
# pidfile: /var/run/radiusd.pid
# config: /etc/raddb/radiusd.conf

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

# Get radiusd config
# If you need to pass any command line options to radiusd, create the 
# /etc/sysconfig/radiusd file and add a line RADIUSOPTS="<your option here>"
[ -f /etc/sysconfig/radiusd ] && . /etc/sysconfig/radiusd

RETVAL=0
prog="radiusd"

start() {
        echo -n $"Starting $prog: "
        daemon radiusd $RADIUSOPTS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/radiusd
	return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: " 
        killproc radiusd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/radiusd
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status radiusd
	;;
  restart|reload)
	stop
	sleep 2
	start
	;;
  condrestart)
	if [ -f /var/lock/subsys/radiusd ]; then
            stop
            start
        fi
	;;
  *)
	echo  $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
	exit 1
esac

exit $RETVAL
