ExtMail服务器社区's Archiver

hzqbbc 发表于 2002-12-8 08:53

我惯用的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 &#39;{ print $1 }&#39;`"
echo "Log_sizes = `du -s $RAN/maillog|awk &#39;{ print $1}&#39;`"
echo "Mail_sent = `cat $RAN/maillog |fgrep status=sent | wc -l|awk &#39;{ print $1 }&#39;`"
rm -rf $RAN[/code]

linliangde 发表于 2009-12-8 12:18

请问awk &#39;{ print $1 }&#39;是什么意思啊,执行的时候怎么有错误呢

mouse 发表于 2009-12-9 22:46

:funk:  02年的帖子都给楼上的翻到,厉害,你不翻出来我都看不到呢。哈。

tinazhou04 发表于 2009-12-29 10:23

回复 1# hzqbbc 的帖子

请问怎么用哈?不是太理解

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.