#!/bin/bash
n=1
echo "检查xxx服务..."
while true
do
if test $n -gt 20
then
echo "xxx服务启动失败"
break
fi
sleep 5
n=$(($n+1))
port=`netstat -antp | grep "0.0.0.0:8080"`
if [ ${#port} -gt 3 ]; then
echo "xxx服务已经启动"
break;
fi
n=1
echo "检查xxx服务..."
while true
do
if test $n -gt 20
then
echo "xxx服务启动失败"
break
fi
sleep 5
n=$(($n+1))
port=`netstat -antp | grep "0.0.0.0:8080"`
if [ ${#port} -gt 3 ]; then
echo "xxx服务已经启动"
break;
fi
done
本文转自 linuxpp 51CTO博客,原文链接:http://blog.51cto.com/1439337369/1715714,如需转载请自行联系原作者