963210
#!/bin/bash
963210
#
963210
# krb5kdc      Start and stop the Kerberos 5 servers.
963210
#
963210
# chkconfig:   - 35 65
963210
# description: Kerberos 5 is a trusted third-party authentication system.  \
963210
#	       This script starts and stops the server that Kerberos 5 \
963210
#	       clients need to connect to in order to obtain credentials.
963210
# processname: krb5kdc
963210
# config: /etc/sysconfig/krb5kdc
963210
# pidfile: /var/run/krb5kdc.pid
963210
#
963210
963210
### BEGIN INIT INFO
963210
# Provides: krb5kdc
963210
# Required-Start: $local_fs $network
963210
# Required-Stop: $local_fs $network
963210
# Should-Start: portreserve
963210
# Default-Start:
963210
# Default-Stop: 0 1 2 3 4 5 6
963210
# Short-Description: start and stop the Kerberos 5 KDC
963210
# Description: The krb5kdc is the Kerberos 5 key distribution center, which \
963210
#              issues credentials to Kerberos 5 clients.
963210
### END INIT INFO
963210
963210
# Get config.
963210
. /etc/sysconfig/network
963210
963210
# Get config.
963210
[ -r /etc/sysconfig/krb5kdc ] && . /etc/sysconfig/krb5kdc
963210
963210
# Source function library.
963210
. /etc/rc.d/init.d/functions
963210
963210
RETVAL=0
963210
prog="Kerberos 5 KDC"
963210
krb5kdc=/usr/sbin/krb5kdc
963210
pidfile=/var/run/krb5kdc.pid
963210
PATH=/usr/lib64/krb5:/usr/lib/krb5:"$PATH"
963210
963210
# Shell functions to cut down on useless shell instances.
963210
start() {
963210
	[ -x $krb5kdc ] || exit 5
963210
	echo -n $"Starting $prog: "
963210
	# tell portreserve to release the kerberos-iv port
963210
	[ -x /sbin/portrelease ] && /sbin/portrelease kerberos-iv &>/dev/null || :
963210
	daemon ${krb5kdc} ${KRB5REALM:+-r ${KRB5REALM}} -P $pidfile $KRB5KDC_ARGS
963210
	RETVAL=$?
963210
	echo
963210
	if test $RETVAL -ne 0 ; then
963210
	    if status ${krb5kdc} > /dev/null ; then
963210
		RETVAL=0
963210
	    fi
963210
	fi
963210
	[ $RETVAL = 0 ] && touch /var/lock/subsys/krb5kdc
963210
}
963210
stop() {
963210
	echo -n $"Stopping $prog: "
963210
	killproc ${krb5kdc}
963210
	RETVAL=$?
963210
	echo
963210
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/krb5kdc
963210
}
963210
reload() {
963210
	echo -n $"Reopening $prog log file: "
963210
	killproc ${krb5kdc} -HUP
963210
        RETVAL=$?
963210
	echo
963210
}
963210
963210
# See how we were called.
963210
case "$1" in
963210
  start)
963210
	start
963210
	;;
963210
  stop)
963210
	stop
963210
	;;
963210
  restart)
963210
	stop
963210
	start
963210
	;;
963210
  reload)
963210
        reload
963210
        ;;
963210
  status)
963210
	status ${krb5kdc}
963210
        RETVAL=$?
963210
	;;
963210
  condrestart)
963210
	if [ -f /var/lock/subsys/krb5kdc ] ; then
963210
		stop
963210
		start
963210
	fi
963210
	;;
963210
  *)
963210
	echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
963210
	RETVAL=2
963210
	;;
963210
esac
963210
963210
exit $RETVAL