本文共 312 字,大约阅读时间需要 1 分钟。
#!/bin/bash
IP=172.22.1.1
PORT=3306
myfile='/etc/zabbix/data/index.html'
rm -f ${myfile}
cd /etc/zabbix/data &&
wget ${IP}:${PORT} >/dev/null 2>&1
if [ -f "${myfile}" ]; then
#删除文件
rm -f ${myfile}
#1 表示端口能通
echo 1
else
#0 表示端口不通
echo 0
fi