- Changed init script to look in /etc/yp.conf for the domain name when not
already set. (bz 113386) - Reworked init script to eliminate unreasonable hangs when ypbind cannot bind to nis server. (bz 112770)
This commit is contained in:
parent
2fb6b54bab
commit
713c992128
57
ypbind.init
57
ypbind.init
@ -22,14 +22,16 @@ OTHER_YPBIND_OPTS=""
|
|||||||
# Check for and source configuration file otherwise set defaults
|
# Check for and source configuration file otherwise set defaults
|
||||||
[ -f /etc/sysconfig/ypbind ] && . /etc/sysconfig/ypbind
|
[ -f /etc/sysconfig/ypbind ] && . /etc/sysconfig/ypbind
|
||||||
|
|
||||||
[ -z "$NISTIMEOUT" ] && NISTIMEOUT=20
|
# NISTIMEOUT should be a multiple of 15 since
|
||||||
|
# ypwhich has a hardcoded 15sec timeout
|
||||||
|
[ -z "$NISTIMEOUT" ] && NISTIMEOUT=45
|
||||||
|
|
||||||
# Check that networking is configured.
|
# Check that networking is configured.
|
||||||
[ "${NETWORKING}" = "no" ] && exit 0
|
[ "${NETWORKING}" = "no" ] && exit 0
|
||||||
|
|
||||||
selinux_on() {
|
selinux_on() {
|
||||||
[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || return
|
[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || return
|
||||||
echo $"Turning on allow_ypbind SELinux boolean"
|
#echo $"Turning on allow_ypbind SELinux boolean"
|
||||||
setsebool allow_ypbind=1
|
setsebool allow_ypbind=1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ selinux_off() {
|
|||||||
. /etc/selinux/${SELINUXTYPE}/modules/active/booleans.local
|
. /etc/selinux/${SELINUXTYPE}/modules/active/booleans.local
|
||||||
fi
|
fi
|
||||||
if [ $allow_ypbind == 0 ]; then
|
if [ $allow_ypbind == 0 ]; then
|
||||||
echo $"Turning off allow_ypbind SELinux boolean"
|
#echo $"Turning off allow_ypbind SELinux boolean"
|
||||||
setsebool allow_ypbind=$allow_ypbind
|
setsebool allow_ypbind=$allow_ypbind
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -49,52 +51,68 @@ selinux_off() {
|
|||||||
start() {
|
start() {
|
||||||
DOMAINNAME=`domainname`
|
DOMAINNAME=`domainname`
|
||||||
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
|
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
|
||||||
|
echo -n $"Setting NIS domain: "
|
||||||
if [ -n "$NISDOMAIN" ]; then
|
if [ -n "$NISDOMAIN" ]; then
|
||||||
action $"Setting NIS domain name $NISDOMAIN: " domainname $NISDOMAIN
|
action $"domain is '$NISDOMAIN' " domainname $NISDOMAIN
|
||||||
|
else # See if the domain is set in config file
|
||||||
|
NISDOMAIN=`grep "domain" /etc/yp.conf | grep -v ^# | \
|
||||||
|
awk '{print $2}'`
|
||||||
|
if [ -n "$NISDOMAIN" ]; then
|
||||||
|
action $"domain is '$NISDOMAIN' " \
|
||||||
|
domainname $NISDOMAIN
|
||||||
else
|
else
|
||||||
exit 1
|
action $"domain not found" /bin/false
|
||||||
|
logger -t ypbind $"domain not found"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
echo -n $"Starting NIS service: "
|
||||||
selinux_on
|
selinux_on
|
||||||
echo -n $"Binding to the NIS domain: "
|
|
||||||
daemon ypbind $OTHER_YPBIND_OPTS
|
daemon ypbind $OTHER_YPBIND_OPTS
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
if [ $RETVAL -ne 0 ]; then
|
if [ $RETVAL -ne 0 ]; then
|
||||||
selinux_off
|
selinux_off
|
||||||
|
logger -t ypbind "failed to start!"
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
fi
|
fi
|
||||||
|
echo -n $"Binding NIS service: "
|
||||||
# the following fixes problems with the init scripts continuing
|
# the following fixes problems with the init scripts continuing
|
||||||
# even when we are really not bound yet to a server, and then things
|
# even when we are really not bound yet to a server, and then things
|
||||||
# that need NIS fail.
|
# that need NIS fail.
|
||||||
echo -n $"Listening for an NIS domain server."
|
timeout=$NISTIMEOUT
|
||||||
for (( times = 1; times < $NISTIMEOUT; times++ )); do
|
while [ $timeout -gt 0 ]; do
|
||||||
/usr/sbin/rpcinfo -p | LC_ALL=C fgrep -q ypbind && ypwhich > /dev/null 2>&1
|
/usr/sbin/rpcinfo -p | LC_ALL=C fgrep -q ypbind && \
|
||||||
|
/usr/bin/ypwhich > /dev/null 2>&1
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
sleep 1
|
echo -n "..."
|
||||||
echo -n "."
|
# ypwhich has a hardcode 15sec timeout
|
||||||
|
# so subtract that from NISTIMEOUT to
|
||||||
|
# to see of we should continue to wait
|
||||||
|
timeout=`expr $timeout - 15`
|
||||||
done
|
done
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
logger -t ypbind "bound to NIS server `ypwhich 2> /dev/null`"
|
logger -t ypbind \
|
||||||
|
"NIS domain: `domainname`, NIS server: `ypwhich 2> /dev/null`"
|
||||||
touch /var/lock/subsys/ypbind
|
touch /var/lock/subsys/ypbind
|
||||||
|
success
|
||||||
else
|
else
|
||||||
killproc ypbind
|
logger -t ypbind \
|
||||||
# if we used brute force (like kill -9) we don't want those around
|
"NIS server for domain `domainname` is not responding."
|
||||||
if [ x$(domainname) != x ] ; then
|
failure
|
||||||
rm -f /var/yp/binding/$(domainname)*
|
|
||||||
fi
|
|
||||||
failure "attempting to contact yp server"
|
|
||||||
selinux_off
|
selinux_off
|
||||||
|
RETVAL=100
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
echo -n $"Shutting down NIS services: "
|
echo -n $"Shutting down NIS service: "
|
||||||
killproc ypbind
|
killproc ypbind
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ] ; then
|
if [ $RETVAL -eq 0 ] ; then
|
||||||
@ -120,6 +138,7 @@ RETVAL=0
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
start
|
start
|
||||||
|
[ $? -eq 100 ] && stop
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stop
|
stop
|
||||||
|
@ -92,6 +92,10 @@ exit 0
|
|||||||
%changelog
|
%changelog
|
||||||
* Tue Apr 17 2007 Steve Dickson <steved@redhat.com> - 3:1.19-9
|
* Tue Apr 17 2007 Steve Dickson <steved@redhat.com> - 3:1.19-9
|
||||||
- Fixed typo in init script (bz 233459)
|
- Fixed typo in init script (bz 233459)
|
||||||
|
- Changed init script to look in /etc/yp.conf for the
|
||||||
|
domain name when not already set. (bz 113386)
|
||||||
|
- Reworked init script to eliminate unreasonable
|
||||||
|
hangs when ypbind cannot bind to nis server. (bz 112770)
|
||||||
|
|
||||||
* Tue Apr 3 2007 Steve Dickson <steved@redhat.com> - 3:1.19-8
|
* Tue Apr 3 2007 Steve Dickson <steved@redhat.com> - 3:1.19-8
|
||||||
- Replace portmap dependency with an rpcbind dependency (bz 228894)
|
- Replace portmap dependency with an rpcbind dependency (bz 228894)
|
||||||
|
Loading…
Reference in New Issue
Block a user