#!/bin/sh
#
# yppasswdd	YP password changing server
#
# chkconfig:	345 43 62
#
# description:  yppasswdd is the RPC server that lets users  change  their \
#		passwords  in  the presence of NIS (a.k.a. YP). It must be \
#		run on the NIS master server for that NIS domain. The client \
#		program is knwon as yppasswd in most cases.
# processname:	rpc.yppasswdd


# Source function library
. /etc/rc.d/init.d/functions

# Get network config
. /etc/sysconfig/network

# Get service config
[ -f /etc/sysconfig/yppasswdd ] && . /etc/sysconfig/yppasswdd

# Check that networking is up.
if is_no "${NETWORKING}"; then
	msg_Network_Down yppasswd
	exit 1
fi

# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/yppasswdd ]; then
		msg_starting "NIS passwd"
		daemon rpc.yppasswdd
	else
		msg_Already_Running rpc.yppasswdd
		exit 1
	fi
	touch /var/lock/subsys/yppasswdd
	;;
  stop)
	if [ ! -f /var/lock/subsys/yppasswdd ]; then
		msg_Not_Running rpc.yppasswdd
		exit 1
	fi
	msg_stopping "NIS passwd"
	killproc rpc.yppasswdd
	rm -f /var/lock/subsys/yppasswdd
	;;
  status)
	status rpc.yppasswdd
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	msg_Usage "$0 {start|stop|status|restart}"
	exit 1
esac

exit 0

