#!/bin/bash

定义变量

app_name="Your App Name" server_ip="172.16.100.48" server_port="904" check_url="http://${server_ip}:${server_port}/healthInfo"

检测服务端口是否可用

result=$(curl --connect-timeout 3 "${check_url}" 2>&1)

if [[ $result =~ "Connection timed out" ]]; then echo "注意:[$app_name] 服务端口检测超时,请排查!" else

其他操作

fi

Shell 脚本 - 检测服务端口可用性

原文地址: https://www.cveoy.top/t/topic/mKrw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录