Check ZooKeeper status before starting dependent service.

- Increased ZK start wait retry count to 5.

Change-Id: If9e50c4de687b69a5f8d0c5f96e25cbd8ffc2a28
diff --git a/onos.sh b/onos.sh
index 0eac025..0a2ea2e 100755
--- a/onos.sh
+++ b/onos.sh
@@ -488,9 +488,17 @@
   return 0
 }
 
+function check-and-start-zk {
+  check-zk
+  local zk_status=$?
+  if [ "$zk_status" -ne 0 ]; then
+    start-zk
+  fi
+}
+
 # wait-zk-or-die {timeout-sec}
 function wait-zk-or-die {
-  local retries=${1:-1}
+  local retries=${1:-5}
   # do-while retries >= 0
   while true; do
     check-zk
@@ -584,7 +592,8 @@
 }
 
 function start-coord {
-  wait-zk-or-die 2
+  check-and-start-zk
+  wait-zk-or-die
 
   if [ ! -d ${LOGDIR} ]; then
     mkdir -p ${LOGDIR}
@@ -632,7 +641,8 @@
 }
 
 function del-coord-info {
-  wait-zk-or-die 1
+  check-and-start-zk
+  wait-zk-or-die
 
   if [ ! -d ${LOGDIR} ]; then
     mkdir -p ${LOGDIR}
@@ -708,7 +718,8 @@
 }
 
 function start-server {
-  wait-zk-or-die 2
+  check-and-start-zk
+  wait-zk-or-die
 
   if [ ! -d ${LOGDIR} ]; then
     mkdir -p ${LOGDIR}