Chinaunix首页 | 论坛 | 博客
  • 博客访问: 567279
  • 博文数量: 78
  • 博客积分: 2043
  • 博客等级: 大尉
  • 技术积分: 733
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-26 11:52
文章分类

全部博文(78)

文章存档

2011年(5)

2009年(64)

2008年(9)

分类:

2009-08-11 17:21:31

#!/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

阅读(1226) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~