File yppasswdd.init of Package ypserv

#! /bin/bash
# Copyright (c) 2002, 2004 SuSE Linux AG
# Copyright (c) 2000, 2001 SuSE GmbH
#
# Author: Thorsten Kukuk <feedback@suse.de>
#
# /etc/init.d/yppasswdd
#
#   and its symbolic link
#
# /usr/sbin/rcyppasswdd
#
# System startup script for the yppasswd daemon
#
### BEGIN INIT INFO
# Provides: yppasswdd
# Required-Start: $remote_fs $portmap ypserv
# Required-Stop: $remote_fs $portmap
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Start ypppasswd daemon
# Description: Start yppasswd daemon to allow NIS users
#	to change the password
### END INIT INFO

YPPASSWDD_BIN=/usr/sbin/rpc.yppasswdd
test -x $YPPASSWDD_BIN || { echo "$YPPASSWDD_BIN not installed";
	if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; }

YPPASSWDD_CONFIG=/etc/sysconfig/ypserv
test -r $YPPASSWDD_CONFIG || { echo "$YPPASSWDD_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; }

# Read config
. $YPPASSWDD_CONFIG

ypflags=
if test "$YPPWD_CHFN" = yes; then
    ypflags="$ypflags -e chfn"
fi
if test "$YPPWD_CHSH" = yes; then
    ypflags="$ypflags -e chsh"
fi

. /etc/rc.status

# First reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting rpc.yppasswdd"
	startproc $YPPASSWDD_BIN -D $YPPWD_SRCDIR $ypflags
	rc_status -v
	;;
    stop)
	echo -n "Shutting down rpc.yppasswdd"
	killproc -TERM $YPPASSWDD_BIN
	rc_status -v
	;;
    try-restart|condrestart)
        if test "$1" = "condrestart"; then
                echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
        fi
        $0 status
        if test $? = 0; then
                $0 restart
        else
                rc_reset        # Not running is not a failure.
        fi
        rc_status
        ;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	echo -n "Reload service rpc.yppasswdd"
        $0 try-restart
        rc_status
	;;
    reload)
	echo -n "Reload service rpc.yppasswdd"
	rc_failed 3
        rc_status -v
	;;
    status)
	echo -n "Checking for rpc.yppasswdd: "
	checkproc $YPPASSWDD_BIN
	rc_status -v
	;;
    probe)
	test /etc/sysconfig/ypserv -nt /var/run/yppasswdd.pid && echo restart
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit