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

全部博文(78)

文章存档

2012年(1)

2011年(9)

2010年(68)

我的朋友

分类:

2010-01-11 01:10:26

Color_Change()
{
    echo -ne "\33[1m\33[3${1}m\33["
}
Color_Recover()
{
    echo -ne "\33[1m\33[37m\33["
}
Start_Wko ()
{
    printf "\n\n\t\t\t WKOPCTLSRV HAPPEN ERROR\n"
    printf "\t\t\t____________________\n"
    printf "\t\t\t"
    for ((i = 0; i < 2; i++))
    do
        for ((j = 0; j < 5; j++))
        do
            usleep 500000
            printf "■"
            tput bel
        done
    done
    #run ret 1
}
Start_Wkc ()
{
    printf "\n\n\t\t\t WKCOMMSRV HAPPEN ERROR\n"
    printf "\t\t\t____________________\n"
    printf "\t\t\t"
    for ((i = 0; i < 2; i++))
    do
        for ((j = 0; j < 5; j++))
        do
            usleep 500000
            printf "■"
            tput bel
        done
    done
    #run ret 2
}

Check_Pro_Flow()
{
    if [[ ${1} == 0 ]]
    then
        printf "\t\t\t 流程服务器没有启动\n"
    fi
}
Check_Pro_Conf()
{
    if [[ ${1} == 0 ]]
    then
        printf "\t\t\t 配置服务器没有启动\n"
    fi
}
Check_Pro_Opcl()
{
    if [[ ${1} == 0 ]]
    then
        printf "\t\t\t 自服务没有启动\n"
    fi
}
Check_Pro_Comm()
{
    if [[ ${1} == 0 ]]
    then
        printf "\t\t\t 通讯服务器没有启动\n"
    fi
}
Check_Pro_Sms()
{
    if [[ ${1} == 0 ]]
    then
        printf "\t\t\t 短信服务器没有启动\n"
    fi
}
Check_Pro_Top()
{
    if [[ ${1} == 0 ]]
    then
        printf "\t\t\t 顶级服务器没有启动\n"
    fi
}
#######################
#main
#######################
while true
do

date=`date '+%Y-%m-%d %H:%M:%S'`
clear
printf  "\n\n\n"       
printf  "\t\t                                     $date\n"
printf  "\t\t----------------------------------------------------------------------------------------------------\n"
printf  "\t\t NetName           PortState   Name      UserName             Pid    ServerName  StarTtime\n"
printf  "\t\t____________________________________________________________________________________________________\n"

Color_Change 2
PORT_COMM=`netstat -nap| grep 5052| awk '{ if ( $6 == "LISTEN" )print $1"  "$6}'`
printf "\t\t   %s"  $PORT_COMM
ps -ef| grep WkCommSrv  | awk '{ if ( $3 == 1 ) print "    " "  WKCOMM""   "$1 "\t" "      "$2 "\t" $8 "   "$5 }'
ps -ef| grep WkCommSrv  | awk '{ if ( $10 ==6 ) print "    " "  WKCOMM""   "$1 "\t" "      "$2 "\t" $8 "   "$5 }'

NUMBER_WKC=`ps -ef | grep WkCommSrv  | grep -v grep | wc -l`
Check_Pro_Comm $NUMBER_WKC
Color_Recover

printf  "\t\t____________________________________________________________________________________________________\n"

Color_Change 3
PORT_WKCL=`netstat -nap| grep 10000| awk '{ if ( $1=="tcp" && $4 =="192.168.10.11:10000" && $6 == "LISTEN") print $1"  "$6}'`
printf "\t\t   %s"  $PORT_WKCL
ps -ef| grep WKOpCtlSrv | awk '{ if ( $3 == 1 ) print "    " "  WKSELF""   "$1 "\t" "      "$2 "\t" $8 "  "$5}'
ps -ef| grep WKOpCtlSrv | awk '{ if ( $10 == 6 ) print "    " "  WKSELF""   "$1 "\t" "      "$2 "\t" $8 "  "$5}'
NUMBER_WKO=`ps -ef | grep WKOpCtlSrv | grep -v grep | wc -l`
Check_Pro_Opcl $NUMBER_WKO
Color_Recover

printf  "\t\t____________________________________________________________________________________________________\n"

Color_Change 4
PORT_WKTOP=`netstat -nap| grep 10002| awk '{ if ( $1=="tcp" && $4 =="192.168.10.11:10002" && $6 == "LISTEN") print $1"  "$6}'`
printf "\t\t   %s"  $PORT_WKTOP
ps -ef| grep WKtopDB    | awk '{ if ( $3 == 1 ) print "    " "  WK_TOP""   "$1 "\t" "      "$2 "\t" $8 "     "$5}'
ps -ef| grep WKtopDB    | awk '{ if ( $10 == 6 ) print "    " "  WK_TOP""   "$1 "\t" "      "$2 "\t" $8 "     "$5}'
NUMBER_TOP=`ps -ef | grep WKtopDB | grep -v grep | wc -l`
Check_Pro_Top $NUMBER_TOP
Color_Recover

printf  "\t\t____________________________________________________________________________________________________\n"

Color_Change 5
PORT_WKCONF=`netstat -nap| grep 5051| awk '{ if ( $1=="tcp" && $6 == "LISTEN") print $1"  "$6}'`
printf "\t\t   %s"  $PORT_WKCONF
ps -ef| grep WKCFSer    | awk '{ if ( $3 == 1 ) print "    " "  WKCONF""   "$1 "\t" "      "$2 "\t" $8 "     "$5}'
ps -ef| grep WKCFSer    | awk '{ if ( $10 == 6 ) print "    " "  WKCONF""   "$1 "\t" "      "$2 "\t" $8 "     "$5}'
NUMBER_CFS=`ps -ef | grep WKCFSer  | grep -v grep | wc -l`
Check_Pro_Conf $NUMBER_CFS
Color_Recover

printf  "\t\t____________________________________________________________________________________________________\n"


Color_Change 6
PORT_WKFLOW=`netstat -nap| grep 30000| awk '{ if ( $1=="tcp" && $6 == "LISTEN" ) print $1"  "$6}'`
printf "\t\t   %s"  $PORT_WKFLOW
ps -ef| grep wkccflow   | awk '{ if ( $3 == 1 ) print "    " "  WKFLOW""   "$1 "\t" "      "$2 "\t" $8 "    "$5}'
ps -ef| grep wkccflow   | awk '{ if ( $10 == 6 ) print "    " "  WKFLOW""   "$1 "\t" "      "$2 "\t"  $8"      "$5}'
NUMBER_FLOW=`ps -ef | grep wkccflow  | grep -v grep | wc -l`
Check_Pro_Flow $NUMBER_FLOW
Color_Recover

printf  "\t\t____________________________________________________________________________________________________\n"

Color_Change 8
printf "\t\t   NONAME           NOPORT"  
ps -ef| grep WKSMSer    | awk '{ if ( $3 == 1 ) print "    " "  WK_SMS""   "$1 "\t" "      "$2 "\t" $8 "     "$5}'
ps -ef| grep WKSMSer    | awk '{ if ( $10 == 6 ) print "    " "  WK_SMS""   "$1 "\t" "      "$2 "\t" $8 "     "$5}'
NUMBER_SMS=`ps -ef | grep WKSMSer | grep -v grep | wc -l`
Check_Pro_Sms $NUMBER_SMS
Color_Recover

printf  "\t\t____________________________________________________________________________________________________\n"

Color_Change 1
test $NUMBER_WKC -ne 0 || Start_Wkc
Color_Recover

Color_Change 1
test $NUMBER_WKO -ne 0 || Start_Wko
Color_Recover

sleep 3

done
阅读(709) | 评论(0) | 转发(0) |
0

上一篇:监控程序的脚本

下一篇:C++类的继承

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