for((i=0;i<120;i++)) do result=`echo dump|nc 127.0.0.1 2181 |grep runtime|grep service |grep vipapis.inventory`; if [ "${result}" = "" ] then #echo $result; echo "service not found in ZK, waiting ..."; sleep 1; fi done
参考:http://www.linuxidc.com/Linux/2012-02/53030.htm