Blame SOURCES/ypbind-post-waitbind

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