ssahani / rpms / freeradius

Forked from rpms/freeradius 5 years ago
Clone
eb87cfe
#!/bin/sh
eb87cfe
#
afeabfb
# radiusd Start/Stop the FreeRADIUS daemon
eb87cfe
#
afeabfb
# chkconfig: - 88 10
afeabfb
# description: Extensible, configurable, high performance RADIUS server.
afeabfb
afeabfb
### BEGIN INIT INFO
afeabfb
# Provides: radiusd
afeabfb
# Required-Start: $network
afeabfb
# Required-Stop:
e6360f6
# Default-Start:
e6360f6
# Default-Stop:
afeabfb
# Should-Start: $time $syslog mysql ldap postgresql samba krb5-kdc
afeabfb
# Should-Stop:
afeabfb
# Short-Description: FreeRADIUS server
afeabfb
# Description: Extensible, configurable, high performance RADIUS server.
afeabfb
### END INIT INFO
eb87cfe
eb87cfe
# Source function library.
eb87cfe
. /etc/rc.d/init.d/functions
eb87cfe
afeabfb
prog=radiusd
afeabfb
afeabfb
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
afeabfb
19b7b49
exec=${exec:=/usr/sbin/$prog}
19b7b49
config_dir=${config_dir:=/etc/raddb}
19b7b49
config=${config:=$config_dir/radiusd.conf}
19b7b49
pidfile=${pidfile:=/var/run/$prog/$prog.pid}
19b7b49
lockfile=${lockfile:=/var/lock/subsys/radiusd}
19b7b49
afeabfb
start() {
afeabfb
    [ -x $exec ] || exit 5
afeabfb
    [ -f $config ] || exit 6
afeabfb
    echo -n $"Starting $prog: "
19b7b49
    daemon --pidfile $pidfile $exec -d $config_dir
afeabfb
    retval=$?
afeabfb
    echo
afeabfb
    [ $retval -eq 0 ] && touch $lockfile
afeabfb
    return $retval
afeabfb
}
afeabfb
afeabfb
stop() {
afeabfb
    echo -n $"Stopping $prog: "
afeabfb
    killproc -p $pidfile $prog
afeabfb
    retval=$?
afeabfb
    echo
afeabfb
    [ $retval -eq 0 ] && rm -f $lockfile
afeabfb
    return $retval
afeabfb
}
afeabfb
afeabfb
restart() {
afeabfb
    stop
afeabfb
    start
afeabfb
}
eb87cfe
afeabfb
reload() {
afeabfb
    # radiusd may not be capable of a 100% configuration reload depending
afeabfb
    # on which loadable modules are in use, if sending the server a
afeabfb
    # HUP is not sufficient then use restart here instead. However, we
afeabfb
    # prefer by default to use HUP since it's what is usually desired.
afeabfb
    #    
afeabfb
    # restart
afeabfb
afeabfb
    kill -HUP `pidofproc -p $pidfile $prog`
afeabfb
}
afeabfb
afeabfb
force_reload() {
afeabfb
    restart
afeabfb
}
afeabfb
afeabfb
rh_status() {
afeabfb
    # run checks to determine if the service is running or use generic status
afeabfb
    status -p $pidfile $prog
afeabfb
}
afeabfb
afeabfb
rh_status_q() {
afeabfb
    rh_status >/dev/null 2>&1
afeabfb
}
eb87cfe
eb87cfe
eb87cfe
case "$1" in
afeabfb
    start)
afeabfb
        rh_status_q && exit 0
afeabfb
        $1
afeabfb
        ;;
afeabfb
    stop)
afeabfb
        rh_status_q || exit 0
afeabfb
        $1
afeabfb
        ;;
afeabfb
    restart)
afeabfb
        $1
eb87cfe
        ;;
afeabfb
    reload)
afeabfb
        rh_status_q || exit 7
afeabfb
        $1
afeabfb
        ;;
afeabfb
    force-reload)
afeabfb
        force_reload
afeabfb
        ;;
afeabfb
    status)
afeabfb
        rh_status
afeabfb
        ;;
afeabfb
    condrestart|try-restart)
afeabfb
        rh_status_q || exit 0
afeabfb
        restart
afeabfb
        ;;
afeabfb
    *)
afeabfb
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
afeabfb
        exit 2
eb87cfe
esac
afeabfb
exit $?