Blame SOURCES/ypbind-post-waitbind

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