#!/bin/bash
# Description: check_tomcat_port
# Author : xzy
# Date : 2014.12.16
#
Description=check_tomcat_port
ip=XX.XX.XX.XX
date_str=`date '+%Y%m%d %k:%M'`
directory=/Disk/bak/local/check_tomcat_port.txt
for i in `cat /Disk/bak/local/tomcat_port.txt`
do
Number=`netstat -ntpl | grep $i | wc -l`
if (($Number == 1))
then
echo $date_str "check Tomcat port:" $i "is ok!" >> $directory
else
echo "host: tfs-DS" $ip "Tomcat port:" $i "is down!" | mail -s $Description xinzhiyu@kaiweijituan.com
fi
done
echo -e "\n" >> $directory
本文转自 xinsir999 51CTO博客,原文链接:http://blog.51cto.com/xinsir/1590809,如需转载请自行联系原作者