#!/bin/sh # # radiusd Start/Stop the FreeRADIUS daemon # # chkconfig: - 88 10 # description: Extensible, configurable, high performance RADIUS server. ### BEGIN INIT INFO # Provides: radiusd # Required-Start: $network # Required-Stop: # Default-Start: # Default-Stop: # Should-Start: $time $syslog mysql ldap postgresql samba krb5-kdc # Should-Stop: # Short-Description: FreeRADIUS server # Description: Extensible, configurable, high performance RADIUS server. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions prog=radiusd [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog exec=${exec:=/usr/local/sbin/$prog} config_dir=${config_dir:=/usr/local/etc/raddb} config=${config:=$config_dir/radiusd.conf} pidfile=${pidfile:=/usr/local/var/run/$prog/$prog.pid} lockfile=${lockfile:=/var/lock/subsys/radiusd} DAEMON="daemon --pidfile $pidfile $exec -d $config_dir" SAFE_RADIUSD=/usr/local/sbin/safe_radiusd do_setlimits() { ulimit -c unlimited ulimit -d unlimited ulimit -f unlimited ulimit -i unlimited ulimit -n 999999 ulimit -q unlimited ulimit -u unlimited ulimit -v unlimited ulimit -x unlimited ulimit -s 244 ulimit -l unlimited return 0 } start() { [ -x $exec ] || exit 5 [ -f $config ] || exit 6 if [ -f $SAFE_RADIUSD ] ; then echo -n $"Starting safe_radiusd: " if [ "$1" == "force" ]; then DAEMON="$SAFE_RADIUSD FORCE" else DAEMON=$SAFE_RADIUSD fi else ISRUNNING=`ps -ef | grep -v safe | grep -v grep | grep -v init | grep -v service | grep radiusd | wc -l` if test "`echo $ISRUNNING`" = "1" ; then echo -n "Radius already is running" RETVAL=1 failure $"$base startup" echo return $RETVAL else do_setlimits echo -n $"Starting radiusd: " fi fi $DAEMON RETVAL=$? if [ $RETVAL = 0 ]; then success $"$base startup" else failure $"$base startup" fi echo return $RETVAL } stop() { echo "Stopping $prog: " if [ "X`pidof radiusd`" != "X" ]; then kill -15 `pidof radiusd` RETVAL=$? [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown" sleep 1 echo -n "Radiusd stopped" else echo -n "Radius is not running" RETVAL=1 fi [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown" echo return $RETVAL } restart() { stop sleep 1 start } status() { ISRUNNING=`ps -ef | grep -v safe | grep -v grep | grep -v init | grep -v service | grep radiusd | wc -l` if test "`echo $ISRUNNING`" = "1" ; then echo "Radius is running" else echo "Radius is not running" fi } case "$1" in start) $@ ;; stop) $1 ;; restart) $1 ;; status) status ;; *) echo $"Usage: $0 {start|stop|restart|status|}" exit 2 esac exit $?