On Fri, Jan 22, 2016 at 09:34:19PM +0000, Mark Brown wrote:
> > This causes ypbind to NEVER properly start, and the bind_wait
> > obviously cannot ever succeed.
>
> It should eventually figure things out?

No, but I have a patch for nis script, attached...

--- dist/nis    2016-01-20 16:18:24.171239577 -0800
+++ nis 2016-01-22 13:08:19.532968676 -0800
@@ -43,24 +43,38 @@

        if [ "`ypwhich 2>/dev/null`" = "" ]
        then
+               running=""
                bound=""
                log_action_begin_msg "binding to YP server"
-               for i in 1 2 3 4 5 6 7 8 9 10
+               for i in `seq 10`
                do
                        sleep 1
-                       log_action_cont_msg "."
-                       if [ "`ypwhich 2>/dev/null`" != "" ]
+                       # make sure ypbind started; rpcbind might not be ready 
yet
+                       if [ -n "$( pidofproc ${NET}/ypbind )" ]
                        then
-                               echo -n " done] "
-                               bound="yes"
-                               break
+                               log_action_cont_msg "."
+                               running="yes"
+                               if [ "`ypwhich 2>/dev/null`" != "" ]
+                               then
+                                       echo -n " done] "
+                                       bound="yes"
+                                       break
+                               fi
+                       else
+                               running=""
+                               # try to start ypbind again
+                               log_action_cont_msg "x"
+                               ypbind_start
                        fi
                done
                # This should potentially be an error
                if [ "$bound" ] ; then
                        log_action_end_msg 0
-               else
+               elif [ "$running" ] ; then
                        log_action_end_msg 1 "backgrounded"
+               else
+                       log_action_end_msg 1 "failed"
+                       exit 1
                fi
        fi
 }
@@ -118,6 +132,14 @@
        return 0
 }

+ypbind_start()
+{
+       start-stop-daemon -b --start --quiet \
+               --exec ${NET}/ypbind -- $broadcast ${YPBINDARGS}
+       # takes some time to come up
+       sleep 3
+}
+
 do_start ()
 {
        oname=`domainname`
@@ -169,8 +191,7 @@
        if want_ypbind
        then
                log_progress_msg "ypbind"
-               start-stop-daemon -b --start --quiet \
-                       --exec ${NET}/ypbind -- $broadcast ${YPBINDARGS}
+               ypbind_start
                bind_wait
        fi
        if [ "$NISSERVER" = "slave" -a "$NISMASTER" != "" ]



--
Nye Liu
n...@mrv.com
(747) 224-2253
(818) 772-0576 fax

"Who would be stupid enough to quote a fictitious character?"
        -- Don Quixote


MRV Communications is a global supplier of packet and optical solutions that 
power the world’s largest networks. Our products combine innovative hardware 
with intelligent software to make networks smarter, faster and more efficient.

Reply via email to