#!bin/bash
message_counts=""
succeed_counts=""
all_succeed_counts=""
fail_counts=""
all_fail_counts=""
#获取昨天的日期
# Set the current month day and year.
month=`date +%m`
day=`date +%d`
year=`date +%Y`
# Add 0 to month. This is a
# trick to make month an unpadded integer.
month=`expr $month + 0`
# Subtract one from the current day.
day=`expr $day - 1`
# If the day is 0 then determine the last
# day of the previous month.
if [ $day -eq 0 ]; then
# Find the preivous month.
month=`expr $month - 1`
# If the month is 0 then it is Dec 31 of
# the previous year.
if [ $month -eq 0 ]; then
month=12
day=31
year=`expr $year - 1`
# If the month is not zero we need to find
# the last day of the month.
else
case $month in
1|3|5|7|8|10|12) day=31;;
4|6|9|11) day=30;;
2)
if ( [ `expr $year % 4` -eq 0 ] && [ `expr $year % 100` -ne 0 ] || [ `expr $year % 400` -eq 0 ] ) ; then
day=29
else
day=28
fi
;;
esac
fi
fi
case $day
in 1|2|3|4|5|6|7|8|9) day='0'$day
esac
case $month
in 1|2|3|4|5|6|7|8|9) month='0'$month
esac
#echo $year$month$day
system_date=$year$month$day
#################################################################################
#Judging the type of the system
echo "Judging the type of the system"
hostname | grep HVPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="HVPS"
fi
#################################################################################
hostname | grep SAPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="SAPS"
fi
#################################################################################
hostname | grep NETS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="NETS"
fi
#################################################################################
hostname | grep BEPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="BEPS"
fi
#################################################################################
hostname | grep IBPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="IBPS"
fi
#################################################################################
hostname | grep SCPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="SCPS"
fi
#################################################################################
hostname | grep PMTS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="PMTS"
fi
#################################################################################
hostname | grep FXCC > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="FXCC"
fi
#################################################################################
hostname | grep CIPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="CIPS"
fi
#################################################################################
hostname | grep IMGS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="IMGS"
fi
#################################################################################
echo "This is $system_type"
sytem_type_Lowercase=`echo $system_type`
typeset -l sytem_type_Lowercase
#################################################################################
#################################################################################
#HVPS SAPS NETS BEPS IBPS
#################################################################################
if [ $system_type = "HVPS" ] || [ $system_type = "SAPS" ] || [ $system_type = "NETS" ] || [ $system_type = "BEPS" ] || [ $system_type = "IBPS" ];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
#collecting corefile documents
#collecting dumps documents
rm -rf $work_dir/core_file_list $work_dir/dump_file_list.log
cd /corefiles
ls -lrt core* >> $work_dir/core_file_list
echo "Collecting dumps documents"
dump_file_dir=`df -g | grep "/dumps/dir1" | awk '{print $7}'`
cd $dump_file_dir
ls -lrt ShowProcInfoDump* >> $work_dir/dump_file_list.log
#################################################################################
#################################################################################
#collecting and analysising message documents
echo "collecting and analysising message documents"
if [ $1 = "-c" ]
then
Global_all=0
Global_success=0
Global_failed=0
rm -f $work_dir/fail_message$system_date.log
cat $2 | while read line
do
LINE=`echo $line | awk -F"/" '{ print $5}'`
seq=`echo $line | awk -F"/" '{ print $6}'`
if [ $LINE != $LINEEE ]
then
echo "============================================================================================" >> $work_dir/Glo.log
echo "cnaps2/"$sytem_type_Lowercase"/log/"$LINEEE >> $work_dir/Glo.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo.log
echo "============================================================================================" >> $work_dir/Glo.log
Global_all=0
Global_success=0
Global_failed=0
fi
cd $line
for seq1 in `ls -rt $system_type* | grep -v *lck`
do
mkdir -p $work_dir"/failed_message/"$LINE"/"$seq
mkdir -p $work_dir"/all_message/"$LINE"/"$seq
failelmessage_dir=$work_dir"/failed_message/"$LINE"/"$seq
allmessage_dir=$work_dir"/all_message/"$LINE"/"$seq
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1" is analyzing!"
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $allmessage_dir/$seq1.log
cat $seq1 | awk '/^\[201/||/^\*\*/{print $0 "'"$zzz"'" "/" "'"$seq"'" "/" "'"$seq1"'"}' >> $allmessage_dir/$seq1.log
#############################
perl -e 'print reverse <>' $allmessage_dir/$seq1.log >> $work_dir/template1.log
sed '/CU1I0000/{N;d; }' $work_dir/template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template2.log
perl -e 'print reverse <>' $work_dir/template2.log >> $filelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
sum_all_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep "CU1I0000" | wc -l`
sum_fail_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep -v "CU1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $failelmessage_dir/$seq1.log
echo "messages of /cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1" are calculatting"
echo "sum_all_temp messages have been sent ,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq1.log
#######################
#######################
echo "#########################################################################" >> $work_dir/Glo.log
echo "#########################################################################" >> $work_dir/Glo.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $work_dir/Glo.log
echo "$sum_all_temp messages have been sent, among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo.log
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template1.log
rm -rf $work_dir/template2.log
done
LINEEE=`echo $LINE`
done
echo "Collecting and Analysising console* documents"
console_dir=`df -g | grep "cics_regions" | awk '{ print $7 }' | grep $system_type | grep -v "dumps"`
cd $console_dir
for ii in `ls -rt | grep "console*" | grep -v "nam" | grep -v "msg"`
do
echo $console_dir"/"$ii" is analyzing!"
cat $ii | awk '/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]E/||/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]W/{print $0 "-----------" "'"$console_dir"'" "/" "'"$ii"'"}' >> $work_dir/console_error.log
done
console_counts=`cat $work_dir/console_error.log | grep "^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]" | wc -l`
echo "==============================================================================================" >> $work_dir/console_error.log
echo "there are $console_counts error messages" >> $work_dir/console_error.log
else
if [ $# = 0 ];then
cd /cnaps2/$system_type_Lowercase/log
rm -rf $work_dir/fail_message$system_date.log
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d | awk -F"/" '{ print $5 }' | uniq >> $work_dir/type_list.log
########
########
########
for LINE in `cat $work_dir/type_list.log`
do
Global_all=0
Global_success=0
Global_failed=0
cd /cnaps2/$system_type_Lowercase/log/$LINE
zzz="/cnaps2/$system_type_Lowercase/log/$LINE"
for seq in `ls | grep "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"`
do
cd /cnaps2/$system_type_Lowercase/log/$LINE/$seq
for seq1 in `ls -rt $system_type* | grep -v *lck`
do
mkdir -p $work_dir"/failed_message/"$LINE"/"$seq
mkdir -p $work_dir"/all_message/"$LINE"/"$seq
failelmessage_dir=$work_dir"/failed_message/"$LINE"/"$seq
allmessage_dir=$work_dir"/all_message/"$LINE"/"$seq
echo "/cnaps2/"$system_type_Lowercase"/log/"$LINE/$seq"/"$seq1" is analyzing!"
echo "/cnaps2/"$system_type_Lowercase"/log/"$LINE/$seq"/"$seq1 >> $allmessage_dir/$seq1.log
cat $seq1 | awk '/^\[201/||/^\*\*/{print $0 "'"$zzz"'" "/" "'"$seq"'" "/" "'"$seq1"'"}' >> $allmessage_dir/$seq1.log
#########################################################################################################
perl -e 'print reverse <>' $allmessage_dir/$seq1.log >> $work_dir/template1.log
sed '/CU1I0000/{N;d; }' $work_dir/template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template2.log
perl -e 'print reverse <>' $work_dir/template2.log >> $filelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
sum_all_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep "CU1I0000" | wc -l`
sum_fail_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep -v "CU1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $failelmessage_dir/$seq1.log
echo "messages of /cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1" are calculatting"
echo "sum_all_temp messages have been sent ,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq1.log
#######################
#######################
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $work_dir/Glo_$1_$2.log
echo "$sum_all_temp messages have been sent, among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1_$2.log
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template1.log
rm -rf $work_dir/template2.log
done
done
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
echo "cnaps2/"$sytem_type_Lowercase"/log/"$LINEEE >> $work_dir/Glo_$1_$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1_$2.log
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
done
rm -rf $work_dir/type_list.log
###########################################################################################################
###########################################################################################################
echo "Collecting and Analysising console* documents"
console_dir=`df -g | grep "cics_regions" | awk '{ print $7 }' | grep $system_type | grep -v "dumps"`
cd $console_dir
for ii in `ls -rt | grep "console*" | grep -v "nam" | grep -v "msg"`
do
echo $console_dir"/"$ii" is analyzing!"
cat $ii | awk '/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]E/||/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]W/{print $0 "-----------" "'"$console_dir"'" "/" "'"$ii"'"}' >> $work_dir/console_error.log
done
console_counts=`cat $work_dir/console_error.log | grep "^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]" | wc -l`
echo "==============================================================================================" >> $work_dir/console_error.log
echo "there are $console_counts error messages" >> $work_dir/console_error.log
fi
#####################################################################################################
#####################################################################################################
#####################################################################################################
if [ $# = 2 ];then
mkdir $work/ssss
time_year_s=`echo $1 | cut -c 1-4`
time_year_ss=`echo $1 | cut -c 3-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_year_ee=`echo $2 | cut -c 3-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
##############
##############
##################################
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d | awk -F"/" '{ print $5 }' | uniq >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
find /cnaps2/$system_type_Lowercase/log/$LINE -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/ssss/zzzz.log
##########################################################################################################################
##########################################################################################################################
##########################################################################################################################
cat $work_dir/ssss/zzzz.log | awk -F"/" '{print $NF}' >> $work_dir/ssss/zzzz1.log
cat $work_dir/ssss/zzzz1.log | while read ZZZZ
do
if [ "$ZZZZ" -ge "$serch_tag_s"] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/ssss/zzzz.log | grep $ZZZZ >> $work_dir/ssss/$LINE
fi
done
##########################################################################################################################
##########################################################################################################################
##########################################################################################################################
rm -rf $work_dir/ssss/zzzz1.log
rm -rf $work_dir/ssss/zzzz.log
done
for i in `ls -rt $work_dir/ssss/`
do
echo $work_dir/ssss/$i >> $work_dir/need_to_analysis_list.log
done
################################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
echo $log_serch_tag_s
echo $log_serch_tag_e
################################################
cat $work_dir/need_to_analysis_list.log | while read LINE
do
Global_all=0
Global_success=0
Global_failed=0
cat $LINE | while read date_dir
do
zzz=`echo $date_dir | awk -F"/" '{ print $5 "/" $6 }'`
############
cat $date_dir
for seq2 in `ls -rt $system_type* | grep -v *lck`
do
#########
mkdir -p $work_dir"/failed_message/"$zzz
mkdir -p $work_dir"/all_message/"$zzz
failelmessage_dir=$work_dir"/failed_message/"$zzz
allmessage_dir=$work_dir"/all_message/"$zzz
echo $date_dir"/"$seq2" is analyzing!"
echo $date_dir"/"$seq2 >> $allmessage_dir/$seq2.log
cat $seq2 | awk '/^\[201/||/^\*\*/{print $0 "'"$date_dir"'" "/" "'"$seq2"'"}' >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0}}' >> $allmessage_dir/$seq2.log
rm -rf $work_dir/template.log
##############################################################################
##############################################################################
##############################################################################
perl -e 'print reverse <>' $allmessage_dir/$seq2.log >> $work_dir/template1.log
sed '/CU1I0000/{N;d; }' $work_dir/template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template2.log
perl -e 'print reverse <>' $work_dir/template2.log >> $filelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
sum_all_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $seq2 | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $seq2 | grep "CU1I0000" | wc -l`
sum_fail_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $seq2 | grep -v "CU1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo $date_dir"/"$seq2 >> $failelmessage_dir/$seq2.log
echo "messages of "$date_dir"/"$seq2" are calculatting"
echo "sum_all_temp messages have been sent ,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq2.log
#######################
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo $date_dir"/"$seq2 >> $work_dir/Glo_$1_$2.log
echo "$sum_all_temp messages have been sent, among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1_$2.log
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template1.log
rm -rf $work_dir/template2.log
done
done
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
echo "cnaps2/"$sytem_type_Lowercase"/log/"$zzz >> $work_dir/Glo_$1_$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1_$2.log
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
done
rm -rf $work_dir/ssss
rm -rf $work_dir/documents_name.log
rm -rf $work_dir/need_to_analysis_list.log
##################################
##################################
##################################
echo "Collecting and Analysising console* documents"
log_serch_tag_s=$time_year_ss"-"$time_month_s"-"$time_day_s""$time_hour_s":"$time_minute_s":"$time_second_s
log_serch_tag_e=$time_year_ee"-"$time_month_e"-"$time_day_e""$time_hour_e":"$time_minute_e":"$time_second_e
echo $log_serch_tag_s
echo $log_serch_tag_s
console_dir=`df -g | grep "cics_regions" | awk '{ print $7 }' | grep $system_type | grep -v "dumps"`
cd $console_dir
for ii in `ls -rt | grep "console*" | grep -v "nam" | grep -v "msg"`
do
echo $console_dir"/"$ii" is analyzing!"
cat $ii | awk '/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]E/||/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]W/{print $0 "-----------" "'"$console_dir"'" "/" "'"$ii"'"}' >> $work_dir/console_error.log
done $work_dir/temp.log | awk -F'[\ \\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0}}' >> $work_dir/console_error.log
cat
console_counts=`cat $work_dir/console_error.log | grep "^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]" | wc -l`
echo "==============================================================================================" >> $work_dir/console_error.log
echo "there are $console_counts error messages" >> $work_dir/console_error.log
fi
fi
#Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep $system_type | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi
########################################################################################
#PMTS
########################################################################################
if [[ $1 = "PMTS" ]];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
rm -rf $work_dir/successed.log
rm -rf $work_dir/failed.log
date_tag=$year"-"$month"-"$day
########################################################################################
########################################################################################
########################################################################################
#collecting and analysising message documents
echo "collecting and analysising message documents"
if [ $# = 0 ];then
touch $work_dir/successed_tmp.log
touch $work_dir/failed_tmp.log
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_list.log
########################################################################################
########################################################################################
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/success_message/"$date_dir
success_message_dir=$work_dir"/success_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt success.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/successed_tmp1.log
cat $work_dir/successed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/successed_tmp3.log
cat $work_dir/successed_tmp3.log | awk -F"@@@@" '{ print $1 }' >> $success_message_dir/$seq1.log
echo "================================================================================================" >> $success_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/successed_tmp.log
rm -rf $work_dir/successed_tmp1.log
rm -rf $work_dir/successed_tmp3.log
#Succeeded
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_successed_$aabb_$ccdd.log
s_hvps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $success_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $success_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_nets_up_counts
s_nets_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $success_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_beps_up_counts
s_beps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $success_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_ibps_up_counts
sed -e 's/^.................//' $success_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^IBPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $success_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $success_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $success_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $work_dir/successed_tmp.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $success_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
##################################################################
up_succeed_counts=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $success_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_success=$(( $up_Global_success + $up_succeed_counts ))
echo "============================================================================================" >> $success_message_dir/$seq1.log
echo "all_succeed message are $all_counts" >> $success_message_dir/$seq1.log
echo "up_succeed message are $up_succeed_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo $seq >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo "$Global_all message have been sent, up_succeed messages are $up_Global_success!" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo "============================================================================================" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
done
##############################################################################################################################
##############################################################################################################################
##############################################################################################################################
#failed
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/failed_message/"$date_dir
failed_message_dir=$work_dir"/failed_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt fail.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/failed_tmp1.log
cat $work_dir/failed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/failed_tmp3.log
cat $work_dir/failed_tmp3.log | awk -F"@@@@" '{ print $aabb }' >> $failed_message_dir/$seq1.log
echo "================================================================================================" >> $failed_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/failed_tmp.log
rm -rf $work_dir/failed_tmp1.log
rm -rf $work_dir/failed_tmp3.log
#failed
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_failed_$aabb_$ccdd.log
s_hvps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $failed_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $failed_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_nets_up_counts
s_nets_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $failed_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_beps_up_counts
s_beps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $failed_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_ibps_up_counts
sed -e 's/^.................//' $failed_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $failed_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $failed_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $failed_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $failed_message_dir/$seq1.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $failed_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
##################################################################
up_Global_failed=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $failed_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_failed=$(( $up_Global_failed + $up_Global_failed ))
echo "============================================================================================" >> $failed_message_dir/$seq1.log
echo "all_failed message are $all_counts" >> $failed_message_dir/$seq1.log
echo "up_failed message are $up_Global_failed" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo $seq >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo "$Global_all message have been sent, up_failed messages are $up_Global_failed!" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo "============================================================================================" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
done
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/failed_message
rm -rf $work_dir/success_message
fi
############################################################################################################################
############################################################################################################################
if [ $# = 2 ];then
touch $work_dir/successed_tmp.log
touch $work_dir/failed_tmp.log
#######################################
time_year_s=`echo $1 | cut -c 1-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
#########################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
###############################################################################################################################
cat $work_dir/documents_name.log | while read LINE
do
zzzz=`echo $LINE | awk -F"/" '{ print $5 }'`
if [ "$zzzz" -ge "$serch_tag_s" ] && [ "$zzzz" -le "$log_serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $zzzz >> $work_dir/documents_list.log
fi
done
###############################################################################################################################
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/success_message/"$date_dir
success_message_dir=$work_dir"/success_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt success.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/successed_tmp.log
cat $work_dir/successed_tmp.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $work_dir/successed_tmp1.log
cat $work_dir/successed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/successed_tmp3.log
cat $work_dir/successed_tmp3.log | awk -F"@@@@" '{ print $1 }' >> $success_message_dir/$seq1.log
echo "================================================================================================" >> $success_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/successed_tmp.log
rm -rf $work_dir/successed_tmp1.log
rm -rf $work_dir/successed_tmp3.log
#Succeeded
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_successed_$1_$2.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_successed_$$1_$2.log
s_hvps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $success_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $success_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_nets_up_counts
s_nets_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $success_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_beps_up_counts
s_beps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $success_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_ibps_up_counts
sed -e 's/^.................//' $success_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^IBPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $success_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $success_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $success_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $work_dir/successed_tmp.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $success_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
##################################################################
up_succeed_counts=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $success_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_success=$(( $up_Global_success + $up_succeed_counts ))
echo "============================================================================================" >> $success_message_dir/$seq1.log
echo "all_succeed message are $all_counts" >> $success_message_dir/$seq1.log
echo "up_succeed message are $up_succeed_counts" >> $work_dir/up_Global_successed_$1_$2.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_successed_$1_$2.log
echo $seq >> $work_dir/up_Global_successed_$1_$2.log
echo "$Global_all message have been sent, up_succeed messages are $up_Global_success!" >> $work_dir/up_Global_successed_$1_$2.log
echo "============================================================================================" >> $work_dir/up_Global_successed_$1_$2.log
done
##############################################################################################################################
##############################################################################################################################
##############################################################################################################################
#failed
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/failed_message/"$date_dir
failed_message_dir=$work_dir"/failed_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt fail.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/failed_tmp.log
cat $work_dir/failed_tmp.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $work_dir/failed_tmp1.log
cat $work_dir/failed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/failed_tmp3.log
cat $work_dir/failed_tmp3.log | awk -F"@@@@" '{ print $aabb }' >> $failed_message_dir/$seq1.log
echo "================================================================================================" >> $failed_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/failed_tmp.log
rm -rf $work_dir/failed_tmp1.log
rm -rf $work_dir/failed_tmp3.log
#failed
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_failed_$1_$2.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_failed_$1_$2.log
s_hvps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $failed_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $failed_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_nets_up_counts
s_nets_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $failed_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_beps_up_counts
s_beps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $failed_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_ibps_up_counts
sed -e 's/^.................//' $failed_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $failed_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $failed_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $failed_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $failed_message_dir/$seq1.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $failed_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
##################################################################
up_Global_failed=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $failed_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_failed=$(( $up_Global_failed + $up_Global_failed ))
echo "============================================================================================" >> $failed_message_dir/$seq1.log
echo "all_failed message are $all_counts" >> $failed_message_dir/$seq1.log
echo "up_failed message are $up_Global_failed" >> $work_dir/up_Global_failed_$1_$2.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_failed_$1_$2.log
echo $seq >> $work_dir/up_Global_failed_$1_$2.log
echo "$Global_all message have been sent, up_failed messages are $up_Global_failed!" >> $work_dir/up_Global_failed_$1_$2.log
echo "============================================================================================" >> $work_dir/up_Global_failed_$1_$2.log
done
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/failed_message
rm -rf $work_dir/success_message
#Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep $system_type | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi
########################################################################################
#FXCC
########################################################################################
if [[ $system_type = "FXCC" ]];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
temp_line=""
tag=""
succeed_counts=""
fail_counts=""
all_counts=""
Global_all=0
Global_success=0
Global_failed=0
#collecting corefile documents
#collecting dumps documents
rm -rf $work_dir/core_file_list $work_dir/dump_file_list.log
cd /corefiles
ls -lrt core* >> $work_dir/core_file_list
echo "Collecting dumps documents"
dump_file_dir=`df -g | grep "/dumps/dir1" | awk '{print $7}'`
cd $dump_file_dir
ls -lrt ShowProcInfoDump* >> $work_dir/dump_file_list.log
#############################################################################################################
#############################################################################################################
#Collecting and Analysising message documents
echo "Collecting and Analysising message documents"
if [ $# = 0 ];then
for seq1 in `find /fxcc/log/WRMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d`
do
cd $seq1
for seq4 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq1 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WRMC/"$date_dir
mkdir -p $work_dir"/all_message/WRMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WRMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir
echo $seq1"/"$seq4" is analyzing!"
echo $seq1"/"$seq4 >> $allmessage_dir/$seq4.log
cat $seq4 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq1"'" "/" "'"$seq4"'"}' | grep -v "{" >> $allmessage_dir/$seq4.log
perl -e 'print reverse <>' $allmessage_dir/$seq4.log >> $work_dir/WRMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WRMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WRMC_template2.log
perl -e 'print reverse <>' $work_dir/WRMC_template2.log >> $filelmessage_dir/$seq4.log
########################################################################################
WRMC_succeeded_counts=`cat $allmessage_dir/$seq4.log | grep "PF1I0000" | wc -l`
WRMC_all_counts=`cat $allmessage_dir/$seq4.log | grep "^\[2018" | wc -l`
WRMC_fail_counts=`cat $failelmessage_dir/$seq4.log | grep "^\*\*" | grep $seq1 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo $seq1"/"$seq4 >> $failelmessage_dir/$seq4.log
echo "messages of $seq1"/"$seq4 are calculating"
echo "$WRMC_all messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq4.log
########################################################################################
Global_all=$(( $WRMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WRMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WRMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq1"/"$seq4 >> $work_dir/Glo_$1"_"$2.log
echo "$WRMC_all_counts messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WRMC_template1.log
rm -rf $work_dir/WRMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
done
###########################################################################################################
for seq2 in `find /fxcc/log/WBMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d`
do
cd $seq2
for seq3 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq2 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WBMC/"$date_dir
mkdir -p $work_dir"/all_message/WBMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WBMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WBMC/"$date_dir
echo $seq2"/"$seq3" is analyzing!"
echo $seq2"/"$seq3 >> $allmessage_dir/$seq3.log
cat $seq3 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq2"'" "/" "'"$seq3"'"}' | grep -v "{" >> $allmessage_dir/$seq3.log
perl -e 'print reverse <>' $allmessage_dir/$seq3.log >> $work_dir/WBMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WBMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WBMC_template2.log
perl -e 'print reverse <>' $work_dir/WBMC_template2.log >> $filelmessage_dir/$seq3.log
########################################################################################
WBMC_succeeded_counts=`cat $allmessage_dir/$seq3.log | grep "PF1I0000" | wc -l`
WBMC_all_counts=`cat $allmessage_dir/$seq3.log | grep "^\[2018" | wc -l`
WBMC_fail_counts=`cat $failelmessage_dir/$seq3.log | grep "^\*\*" | grep $seq2 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo $seq2"/"$seq3 >> $failelmessage_dir/$seq3.log
echo "messages of $seq2"/"$seq3 are calculating"
echo "$WBMC_all messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq3.log
########################################################################################
Global_all=$(( $WBMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WBMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WBMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq2"/"$seq3 >> $work_dir/Glo_$1"_"$2.log
echo "$WBMC_all_counts messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WBMC_template1.log
rm -rf $work_dir/WBMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
rm -rf $work_dir/all_message
fi
###########################################################################################################
if [ $# = 2 ];then
time_year_s=`echo $1 | cut -c 1-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
##################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
find /fxcc/log/WRMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
ZZZZ=`echo $LINE | awk -F"/" '{ print $5 }'`
if [ "$ZZZZ" -ge "$serch_tag_s" ] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $ZZZZ >> $work_dir/documents_list.log
fi
done
for seq1 in `cat $work_dir/documents_list.log`
do
cd $seq1
for seq4 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq1 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WRMC/"$date_dir
mkdir -p $work_dir"/all_message/WRMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WRMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir
echo $seq1"/"$seq4" is analyzing!"
echo $seq1"/"$seq4 >> $allmessage_dir/$seq4.log
cat $seq4 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq1"'" "/" "'"$seq4"'"}' | grep -v "{" >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $allmessage_dir/$seq4.log
rm -rf $work_dir/template.log
########################################################
########################################################
########################################################
perl -e 'print reverse <>' $allmessage_dir/$seq4.log >> $work_dir/WRMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WRMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WRMC_template2.log
perl -e 'print reverse <>' $work_dir/WRMC_template2.log >> $filelmessage_dir/$seq4.log
########################################################################################
WRMC_succeeded_counts=`cat $allmessage_dir/$seq4.log | grep "PF1I0000" | wc -l`
WRMC_all_counts=`cat $allmessage_dir/$seq4.log | grep "^\[2018" | wc -l`
WRMC_fail_counts=`cat $failelmessage_dir/$seq4.log | grep "^\*\*" | grep $seq1 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo $seq1"/"$seq4 >> $failelmessage_dir/$seq4.log
echo "messages of $seq1"/"$seq4 are calculating"
echo "$WRMC_all messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq4.log
########################################################################################
Global_all=$(( $WRMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WRMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WRMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq1"/"$seq4 >> $work_dir/Glo_$1"_"$2.log
echo "$WRMC_all_counts messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WRMC_template1.log
rm -rf $work_dir/WRMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
done
##################################################################################
rm -rf $work_dir/documents_name.log
find /fxcc/log/WBMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
ZZZZ=`echo $LINE | awk -F"/" '{ print $5 }'`
if [ "$ZZZZ" -ge "$serch_tag_s" ] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $ZZZZ >> $work_dir/documents_list.log
fi
done
for seq2 in `cat $work_dir/documents_list.log`
do
cd $seq2
for seq3 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq2 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WBMC/"$date_dir
mkdir -p $work_dir"/all_message/WBMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WBMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WBMC/"$date_dir
echo $seq2"/"$seq3" is analyzing!"
echo $seq2"/"$seq3 >> $allmessage_dir/$seq3.log
cat $seq3 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq2"'" "/" "'"$seq3"'"}' | grep -v "{" >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $allmessage_dir/$seq3.log
rm -rf $work_dir/template.log
########################################################
########################################################
########################################################
perl -e 'print reverse <>' $allmessage_dir/$seq3.log >> $work_dir/WBMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WBMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WBMC_template2.log
perl -e 'print reverse <>' $work_dir/WBMC_template2.log >> $filelmessage_dir/$seq3.log
########################################################################################
WBMC_succeeded_counts=`cat $allmessage_dir/$seq3.log | grep "PF1I0000" | wc -l`
WBMC_all_counts=`cat $allmessage_dir/$seq3.log | grep "^\[2018" | wc -l`
WBMC_fail_counts=`cat $failelmessage_dir/$seq3.log | grep "^\*\*" | grep $seq2 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo $seq2"/"$seq3 >> $failelmessage_dir/$seq3.log
echo "messages of $seq2"/"$seq3 are calculating"
echo "$WBMC_all messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq3.log
########################################################################################
Global_all=$(( $WBMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WBMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WBMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq2"/"$seq3 >> $work_dir/Glo_$1"_"$2.log
echo "$WBMC_all_counts messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WBMC_template1.log
rm -rf $work_dir/WBMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
fi
#############################################
#############################################
#############################################
#Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep "8888" | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi
#################################################################################
#CIPS
#################################################################################
if [[ $system_type = "CIPS" ]];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
Global_all=0
Global_success=0
Global_failed=0
#collecting corefile documents
#collecting dumps documents
rm -rf $work_dir/core_file_list $work_dir/dump_file_list.log
cd /corefiles
ls -lrt core* >> $work_dir/core_file_list
echo "Collecting dumps documents"
dump_file_dir=`df -g | grep "/dumps/dir1" | awk '{print $7}'`
cd $dump_file_dir
ls -lrt ShowProcInfoDump* >> $work_dir/dump_file_list.log
#############################################################################################################
#############################################################################################################
#Collecting and Analysising message documents
find /cips/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
echo "Collecting and Analysising message documents"
if [ $# = 0 ];then
for LINE in `cat $work_dir/documents_name.log`
do
cd $LINE
Global_all=0
Global_success=0
Global_failed=0
for seq1 in `ls -lrt | grep "^d" | awk '{ print $9 }'`
do
eeeeeee=$LINE"/"$seq1
cd $eeeeeee
for seq2 in `ls -rt | grep -v lck`
do
date_dir=`echo $LINE | awk -F"/" '{ print $4}'`
mkdir -p $work_dir"/failed_message/"$date_dir"/"$seq1
mkdir -p $work_dir"/all_message/WRMC/"$date_dir"/"$seq1
failelmessage_dir=$work_dir"/failed_message/"$date_dir"/"$seq1
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir"/"$seq1
echo $LINE"/"$seq1"/"$seq2" is analyzing!"
echo $LINE"/"$seq1"/"$seq2 >> $allmessage_dir/$seq2.log
cat $seq2 | awk '/^\[201/||/^\*\*/{print $0 "'"$LINE"'" "/" "'"$seq1"'" "/" "'"$seq2"'"}' >> $allmessage_dir/$seq2.log
####################################################################
sed '/R000217/'d $allmessage_dir/$seq2.log >> $work_dir/template1.log
perl -e 'print reverse <>' $work_dir/template1.log >> $work_dir/template2.log
sed '/CI1I0000/{N;d; }' $work_dir/template2.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template3.log
####################################################################
perl -e 'print reverse <>' $work_dir/template3.log >> $failelmessage_dir/$seq2.log
########################################################################################
sum_all_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep "CI1I0000" | wc -l`
sum_fail_temp=`cat $failelmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep -v "CI1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo $LINE"/"$seq1"/"$seq2 >> $failelmessage_dir/$seq2.log
echo "messages of $LINE"/"$seq1"/"$seq2 are calculating"
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq2.log
########################################################################################
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $LINE"/"$seq1"/"$seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
########################################################################################
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template2.log
rm -rf $work_dir/template3.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
rm -rf $work_dir/all_message
done
done
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $LINE >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
fi
###########################################################################################################
if [ $# = 2 ];then
time_year_s=`echo $1 | cut -c 1-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
##################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
find /fxcc/log/WRMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
ZZZZ=`echo $LINE | awk -F"/" '{ print $4 }'`
if [ "$ZZZZ" -ge "$serch_tag_s" ] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $ZZZZ >> $work_dir/documents_list.log
fi
done
###########################################
for LINE in `cat $work_dir/documents_name.log`
do
cd $LINE
Global_all=0
Global_success=0
Global_failed=0
for seq1 in `ls -lrt | grep "^d" | awk '{ print $9 }'`
do
eeeeeee=$LINE"/"$seq1
cd $eeeeeee
for seq2 in `ls -rt | grep -v lck`
do
date_dir=`echo $LINE | awk -F"/" '{ print $4}'`
mkdir -p $work_dir"/failed_message/"$date_dir"/"$seq1
mkdir -p $work_dir"/all_message/WRMC/"$date_dir"/"$seq1
failelmessage_dir=$work_dir"/failed_message/"$date_dir"/"$seq1
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir"/"$seq1
echo $LINE"/"$seq1"/"$seq2" is analyzing!"
echo $LINE"/"$seq1"/"$seq2 >> $allmessage_dir/$seq2.log
cat $seq2 | awk '/^\[201/||/^\*\*/{print $0 "'"$LINE"'" "/" "'"$seq1"'" "/" "'"$seq2"'"}' >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $allmessage_dir/$seq2.log
rm -rf $work_dir/template.log
####################################################################
####################################################################
perl -e 'print reverse <>' $allmessage_dir/$seq2.log >> $work_dir/template2.log
sed '/CI1I0000/{N;d; }' $work_dir/template2.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template3.log
####################################################################
perl -e 'print reverse <>' $work_dir/template3.log >> $failelmessage_dir/$seq2.log
########################################################################################
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
sum_all_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep "CI1I0000" | wc -l`
sum_fail_temp=`cat $failelmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep -v "CI1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo $LINE"/"$seq1"/"$seq2 >> $failelmessage_dir/$seq2.log
echo "messages of $LINE"/"$seq1"/"$seq2 are calculating"
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq2.log
########################################################################################
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $LINE"/"$seq1"/"$seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
########################################################################################
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template2.log
rm -rf $work_dir/template3.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
rm -rf $work_dir/all_message
done
done
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $LINE >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
fi
#############################################
#Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep "8888" | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi
#################################################################################
#IMGS
#################################################################################