5af5b2
#!/bin/bash
5af5b2
#
5af5b2
# kadmind      Start and stop the Kerberos 5 administrative server.
5af5b2
#
5af5b2
# chkconfig:   - 35 65
5af5b2
# description: Kerberos 5 is a trusted third-party authentication system.  \
5af5b2
#	       This script starts and stops the Kerberos 5 administrative \
5af5b2
#              server, which should only be run on the master server for a \
5af5b2
#              realm.
5af5b2
# processname: kadmind
5af5b2
# config: /etc/sysconfig/kadmin
5af5b2
# pidfile: /var/run/kadmind.pid
5af5b2
#
5af5b2
5af5b2
### BEGIN INIT INFO
5af5b2
# Provides: kadmin
5af5b2
# Required-Start: $local_fs $network
5af5b2
# Required-Stop: $local_fs $network
5af5b2
# Should-Start: portreserve
5af5b2
# Default-Start:
5af5b2
# Default-Stop: 0 1 2 3 4 5 6
5af5b2
# Short-Description: start and stop the Kerberos 5 admin server
5af5b2
# Description: The kadmind service allows administrators to remotely manage \
5af5b2
#              the Kerberos 5 realm database.  It should only be run on a \
5af5b2
#              master KDC.
5af5b2
### END INIT INFO
5af5b2
5af5b2
# Get config.
5af5b2
. /etc/sysconfig/network
5af5b2
5af5b2
# Get config.
5af5b2
[ -r /etc/sysconfig/kadmin ] && . /etc/sysconfig/kadmin
5af5b2
5af5b2
# Source function library.
5af5b2
. /etc/init.d/functions
5af5b2
prog="Kerberos 5 Admin Server"
5af5b2
kadmind=/usr/sbin/kadmind
5af5b2
pidfile=/var/run/kadmind.pid
5af5b2
5af5b2
RETVAL=0
5af5b2
5af5b2
# Shell functions to cut down on useless shell instances.
5af5b2
start() {
5af5b2
  	if [ -f /var/kerberos/krb5kdc/kpropd.acl ] ; then
5af5b2
	    echo $"Error. This appears to be a slave server, found kpropd.acl"
5af5b2
	    exit 6
5af5b2
	else
5af5b2
	    [ -x $kadmind ] || exit 5
5af5b2
	fi
5af5b2
	echo -n $"Starting $prog: "
5af5b2
	# tell portreserve to release the kerberos-adm port
5af5b2
	[ -x /sbin/portrelease ] && /sbin/portrelease kerberos-adm &>/dev/null || :
5af5b2
	daemon ${kadmind} ${KRB5REALM:+-r ${KRB5REALM}} -P $pidfile $KADMIND_ARGS
5af5b2
	RETVAL=$?
5af5b2
	echo
5af5b2
	if test $RETVAL -ne 0 ; then
5af5b2
	    if status -l kadmin ${kadmind} > /dev/null ; then
5af5b2
		RETVAL=0
5af5b2
	    fi
5af5b2
	fi
5af5b2
	[ $RETVAL = 0 ] && touch /var/lock/subsys/kadmin
5af5b2
}
5af5b2
stop() {
5af5b2
	echo -n $"Stopping $prog: "
5af5b2
	killproc ${kadmind}
5af5b2
	RETVAL=$?
5af5b2
	echo
5af5b2
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/kadmin
5af5b2
}
5af5b2
reload() {
5af5b2
	echo -n $"Reopening $prog log file: "
5af5b2
	killproc ${kadmind} -HUP
5af5b2
	RETVAL=$?
5af5b2
	echo
5af5b2
}
5af5b2
5af5b2
# See how we were called.
5af5b2
case "$1" in
5af5b2
  start)
5af5b2
	start
5af5b2
	;;
5af5b2
  stop)
5af5b2
	stop
5af5b2
	;;
5af5b2
  restart)
5af5b2
	stop
5af5b2
	start
5af5b2
	;;
5af5b2
  status)
5af5b2
	status -l kadmin ${kadmind}
5af5b2
	RETVAL=$?
5af5b2
	;;
5af5b2
  reload)
5af5b2
	reload
5af5b2
	;;
5af5b2
  condrestart)
5af5b2
	if [ -f /var/lock/subsys/kadmin ] ; then
5af5b2
		stop
5af5b2
		start
5af5b2
	fi
5af5b2
	;;
5af5b2
  *)
5af5b2
	echo $"Usage: $0 {start|stop|status|condrestart|reload|restart}"
5af5b2
	RETVAL=2
5af5b2
	;;
5af5b2
esac
5af5b2
5af5b2
exit $RETVAL