Chinaunix首页 | 论坛 | 博客
  • 博客访问: 256625
  • 博文数量: 78
  • 博客积分: 1465
  • 博客等级: 上尉
  • 技术积分: 972
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-28 13:46
文章分类

全部博文(78)

文章存档

2012年(1)

2011年(9)

2010年(68)

我的朋友

分类:

2010-01-11 01:09:45


#!/bin/bash
Color_Change()
{
        echo -ne "\33[1m\33[3${1}m\33["
}
Color_Recover()
{
        echo -ne "\33[1m\33[37m\33["
}
#################### just test monit program ###############
#
#
#
#
#  byheart
#
# date 2009-08-011
############################################################
#date=`date '+%Y-%m-%d %H:%M:%S'`
#printf "\t\t\t\t $date\n"
#printf '\t===========================================================================\n'
#printf '\t\tPID\t\tNAME\t\tPORT\t\tUSER\n'
#printf '\t===========================================================================\n'


#check ports

check_ws_port ()
{
if [ $1 == 0 ]
then
printf '\t\tWS is not running.\n'
else

/bin/ps -ef |grep run-ws|grep -v "grep"| awk '{print "\t\t"$2,"\t\tRUN-WS","\t\t8100","\t\t"$1}'
fi
}
check_wap_port ()
{
 if [ $1 == 0 ]
 then
 printf '\t\tWAP is not running.\n'
 else
 /bin/ps -ef |grep run-wap|grep -v "grep"|awk '{print "\t\t"$2,"\t\tRUN-WAP","\t9080","\t\t"$1}'
 fi
}

check_opertor_port ()
{
 if [ $1 == 0 ]
 then
 printf '\t\tOPERTOR is not running.\n'
 else
 /bin/ps -ef |grep run-opertor|grep -v "grep"|awk '{print "\t\t"$2,"\t\tRUN-OPERTOR","\t9090","\t\t"$1}'
 fi    

}


while true
do

clear
printf '\n\n'
date=`date '+%Y-%m-%d %H:%M:%S'`
printf "\t\t\t\t $date\n"
printf '\t===========================================================================\n'
printf '\t\tPID\t\tNAME\t\tPORT\t\tUSER\n'
printf '\t===========================================================================\n'


WS_PORT=`netstat -n |grep 8100|grep -v grep |wc -l`
#/bin/ps -ef |grep run-ws|grep -v grep| awk '{print "\t\t"$1,"\t\t"$2}'
check_ws_port $WS_PORT

WAP_PORT=`netstat -n |grep 9080|grep -v grep |wc -l`
check_wap_port $WAP_PORT

OPERTOR_PORT=`netstat -n|grep 9090|grep -v grep |wc -l`
check_opertor_port $OPERTOR_PORT
sleep 3
done
阅读(638) | 评论(0) | 转发(0) |
0

上一篇:awk结构分析

下一篇:监控程序的脚本

给主人留下些什么吧!~~