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