我惯用的postfix的IN/OUT邮件域的分析脚本
是看了一个老外的脚本后得到启发并学会的:)希望对用Postfix的朋友有点用。[code]#!/bin/bash
# mail-statistic.sh :
# Simple script for analysis Postfix maillog
# Version: 0.03
# Author: [email]hzqbbc@hzqbbc.com[/email]
#
RAN=`echo $RANDOM`
echo "Mail log analysis ID is $RAN "
echo "Checking ...................."
echo ""
echo ""
# make a direcotry to contain temp log file
mkdir $RAN
cp /var/log/maillog $RAN/maillog
zcat /var/log/maillog.*.gz >> $RAN/maillog
# statistic recipient
echo "Part one : - Top 10 Recipient domain "
fgrep to= $RAN/maillog | cut -d< -f2 | cut -d> -f1 | cut -d@ -f2 | sort | uniq -c | sort -nr |head
echo ""
echo ""
# statistic sender
echo "Part two: - Top 10 Sender domain "
fgrep from= $RAN/maillog | cut -d< -f2 | cut -d> -f1 | cut -d@ -f2 | sort | uniq -c | sort -nr |head
echo ""
echo ""
# statistic destination mail total count
echo "Part three: Total lines and sizes of log, And total mail sent"
echo "Log_lines = `cat $RAN/maillog |wc -l|awk '{ print $1 }'`"
echo "Log_sizes = `du -s $RAN/maillog|awk '{ print $1}'`"
echo "Mail_sent = `cat $RAN/maillog |fgrep status=sent | wc -l|awk '{ print $1 }'`"
rm -rf $RAN[/code] 请问awk '{ print $1 }'是什么意思啊,执行的时候怎么有错误呢 :funk: 02年的帖子都给楼上的翻到,厉害,你不翻出来我都看不到呢。哈。
回复 1# hzqbbc 的帖子
请问怎么用哈?不是太理解页:
[1]