#!/bin/bash
n=1
echo "mysql服务是否启动"
while true
do
if test $n -gt 20
then
echo "mysql服务启动失败"
break
fi
sleep 5
n=$(($n+1))
port=`netstat -antp | grep "0.0.0.0:3306"` #端口
if [ ${#port} -gt 3 ]; then
echo "mysql服务已经启动"
break;
fi
done
[root@nginx ~]# ./fu.sh
mysql服务是否启动
mysql服务已经启动
shell-检测服务端口是否启动
最新推荐文章于 2024-03-28 19:50:15 发布