shell脚本检测端口是否被占用
check_port() {
echo "Checking instance port ..."
netstat -tlpn | grep "\b$1\b"
}
if check_port 8080
then
echo "port exists"
exit 1
fi
check_port() {
echo "Checking instance port ..."
netstat -tlpn | grep "\b$1\b"
}
if check_port 8080
then
echo "port exists"
exit 1
fi