#!/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
阅读(1221) | 评论(0) | 转发(0) |