首页 > Linux操作系统 > Linux操作系统 > 使用shell生成状态报表
function check_tab
{
total_cnt=`ls -l ../DUMP/$1_[0-9]*.dmp|wc -l`
fin_cnt=`grep COPY_MIG.$1_EXT_[0-9]* *par*.log|wc -l`
par_from_file=`grep COPY_MIG.$1_EXT_[0-9]* *par*.log|tail -1|awk -F: '{print $1}'`
tmp_status=finished
if [ $fin_cnt -eq $total_cnt ]
then
tmp_status=finished
elif [ $fin_cnt -eq 0 ]
then
tmp_status=pending
elif [ $fin_cnt -lt $total_cnt ]
then
tmp_status=processing
fi
echo $1 $fin_cnt of TOTAL $total_cnt completed, "|--"$tmp_status... from $par_from_file >> tmp_check.lst
}
total_tab_cnt=`cat ../parfile/tablst|wc -l`
for i in {1..$total_tab_cnt}
do
tmp_tab_name=`sed -n "${i}p" ../parfile/tablst`
#echo $tmp_tab_name
check_tab $tmp_tab_name
done
awk '
BEGIN{
print "############################################################"
}
{
printf "%30s %4d %2s %5s %5d %3s %-15s %4s %30s \n", $1,$2,$3,$4,$5,$6,$7,$8,$9
}' tmp_check.lst
rm tmp_check.lst
运行后,结果如下所示,这样表的情况就一目了然了。
ICAL_FILES 0 of TOTAL 1 completed, |--pending... from
AC_SOURCE 0 of TOTAL 1 completed, |--pending... from
DRESS_DATA 4 of TOTAL 4 completed, |--finished... from split_par_10_appendata.log
A_NAME_LINK 3 of TOTAL 3 completed, |--finished... from split_par_9_appendata.log
AGREEMENT 1 of TOTAL 1 completed, |--finished... from split_par_8_appendata.log
AT_RESOURCE 4 of TOTAL 4 completed, |--finished... from split_par_7_appendata.log
R1_ACCOUNT 2 of TOTAL 2 completed, |--finished... from split_par_7_appendata.log
DRESS_NAME 3 of TOTAL 3 completed, |--finished... from split_par_6_appendata.log
AAL_BALANCE 0 of TOTAL 16 completed, |--pending... from
IRRANGEMENT 0 of TOTAL 1 completed, |--pending... from
ARGE_GROUP 0 of TOTAL 11 completed, |--pending... from
R1_CHARGES 24 of TOTAL 24 completed, |--finished... from split_par_6_appendata.log
R1_CONTROL 1 of TOTAL 1 completed, |--finished... from split_par_4_appendata.log
_DEBIT_LINK 0 of TOTAL 9 completed, |--pending... from
RMER_CREDIT 0 of TOTAL 1 completed, |--pending... from
RIT_REQUEST 0 of TOTAL 1 completed, |--pending... from
RIT_REQUEST 0 of TOTAL 1 completed, |--pending... from
R1_DISPUTE 1 of TOTAL 1 completed, |--finished... from split_par_10_appendata.log
1E_ACTIVITY 1 of TOTAL 1 completed, |--finished... from split_par_9_appendata.log
XREFERENCES 1 of TOTAL 1 completed, |--finished... from split_par_8_appendata.log
ES_CONTROL 1 of TOTAL 1 completed, |--finished... from split_par_7_appendata.log
R1_INVOICE 1 of TOTAL 1 completed, |--finished... from split_par_10_appendata.log
AR1_MEMO 1 of TOTAL 1 completed, |--finished... from split_par_6_appendata.log
AY_CHANNEL 0 of TOTAL 1 completed, |--pending... from
R1_PAYMENT 1 of TOTAL 1 completed, |--finished... from split_par_9_appendata.log
1T_ACTIVITY 1 of TOTAL 1 completed, |--finished... from split_par_4_appendata.log
RNT_DETAILS 1 of TOTAL 1 completed, |--finished... from split_par_8_appendata.log
_ND_BALANCE 0 of TOTAL 1 completed, |--pending... from
AND_REQUEST 0 of TOTAL 1 completed, |--pending... from
1_TAX_ITEM 0 of TOTAL 34 completed, |--pending... from
CTION_LOG 21 of TOTAL 21 completed, |--finished... from split_par_6_appendata.log
ED_CREDIT 0 of TOTAL 2 completed, |--pending... from
WRITE_OFF 1 of TOTAL 1 completed, |--finished... from split_par_10_appendata.log
COUNT_EXT 1 of TOTAL 1 completed, |--finished... from split_par_9_appendata.log
T_COUNTER 1 of TOTAL 1 completed, |--finished... from split_par_8_appendata.log
S_CONTROL 1 of TOTAL 1 completed, |--finished... from split_par_7_appendata.log
BILLED_OC 1 of TOTAL 1 completed, |--finished... from split_par_6_appendata.log
Y_HISTORY 0 of TOTAL 32 completed, |--pending... from
_REQUESTS 1 of TOTAL 1 completed, |--finished... from split_par_4_appendata.log
ADD_COMPS 4 of TOTAL 4 completed, |--finished... from split_par_10_appendata.log
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8494287/viewspace-1347063/ ,如需转载,请注明出处,否则将追究法律责任。