Blame SOURCES/ypbind-post-waitbind

6c4d24
#!/bin/sh
6c4d24
#
6c4d24
# ypbind-domain
6c4d24
#
6c4d24
# description: This is part of former ypbind init script, which is used 
6c4d24
#              to fix problems with the init scripts continuing even when 
6c4d24
#              we are really not bound yet to a server, and then things
6c4d24
#              that need NIS fail.
6c4d24
#
6c4d24
6c4d24
# NISTIMEOUT should be a multiple of 15 since
6c4d24
# ypwhich has a hardcoded 15sec timeout
6c4d24
[ -z "$NISTIMEOUT" ] && NISTIMEOUT=45
6c4d24
6c4d24
logger -t ypbind $"Binding NIS service"
6c4d24
6c4d24
timeout=$NISTIMEOUT
6c4d24
firsttime=1
6c4d24
rpcbound=0
6c4d24
SECONDS=0
6c4d24
retval=0
6c4d24
while [ $SECONDS -lt $timeout ] || [ $firsttime -eq 1 ] ; do
6c4d24
firsttime=0
6c4d24
if /usr/sbin/rpcinfo -p | LC_ALL=C fgrep -q ypbind
6c4d24
then
6c4d24
    rpcbound=1
6c4d24
    /usr/bin/ypwhich > /dev/null 2>&1
6c4d24
    retval=$?
6c4d24
    if [ $retval -eq 0 ]; then
6c4d24
	break;
6c4d24
    fi
6c4d24
fi
6c4d24
sleep 2
6c4d24
done
6c4d24
6c4d24
logger -t ypbind "Binding took $SECONDS seconds"
6c4d24
6c4d24
if [ $retval -eq 0 ]; then
6c4d24
    if [ $rpcbound -eq 0 ]; then
6c4d24
        logger -t ypbind \
6c4d24
            "NIS domain: `domainname`, ypbind not registered with rpcbind."
6c4d24
    else
6c4d24
        logger -t ypbind \
6c4d24
            "NIS domain: `domainname`, NIS server: `ypwhich 2> /dev/null`"
6c4d24
    fi
6c4d24
else
6c4d24
    logger -t ypbind \
6c4d24
        "NIS server for domain `domainname` is not responding."
6c4d24
    logger -t ypbind \
6c4d24
        "Killing ypbind with PID $MAINPID."
6c4d24
    kill -s 15 $MAINPID || :
6c4d24
    logger -t ypbind \
6c4d24
        "Try increase NISTIMEOUT in /etc/sysconfig/ypbind"
6c4d24
fi
6c4d24
6c4d24
exit $retval
6c4d24