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