From 094ca96844842928810f14844413109fc6cdd890 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 3 Feb 2013 00:59:38 -0700 Subject: Initial Alpine Version --- contrib/utils/mailtrfc.sh | 130 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100755 contrib/utils/mailtrfc.sh (limited to 'contrib/utils/mailtrfc.sh') diff --git a/contrib/utils/mailtrfc.sh b/contrib/utils/mailtrfc.sh new file mode 100755 index 00000000..2ef69cdc --- /dev/null +++ b/contrib/utils/mailtrfc.sh @@ -0,0 +1,130 @@ +#!/bin/sh +# +# T H E P I N E M A I L S Y S T E M +# +# Laurence Lundblade and Mike Seibel +# Networks and Distributed Computing +# Computing and Communications +# University of Washington +# Administration Building, AG-44 +# Seattle, Washington, 98195, USA +# Internet: lgl@CAC.Washington.EDU +# mikes@CAC.Washington.EDU +# +# Please address all bugs and comments to "pine-bugs@cac.washington.edu" +# +# Copyright 1991, 1992 University of Washington +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose and without fee is hereby granted, provided +# that the above copyright notice appears in all copies and that both the +# above copyright notice and this permission notice appear in supporting +# documentation, and that the name of the University of Washington not be +# used in advertising or publicity pertaining to distribution of the software +# without specific, written prior permission. This software is made +# available "as is", and +# THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +# WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN +# NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL, +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT +# (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION +# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# +# Pine is in part based on The Elm Mail System: +# *********************************************************************** +# * The Elm Mail System - $Revision: 2.13 $ $State: Exp $ * +# * * +# * Copyright (c) 1986, 1987 Dave Taylor * +# * Copyright (c) 1988, 1989 USENET Community Trust * +# *********************************************************************** +# +# + + +# +# mailtrfc.sh -- A shell script to analyze the mail traffic as logged in +# /usr/spool/mqueue/syslog*. This currently as the University of Washington +# domains wired in and needs to be made more general. Also, lots more +# formats of message ID's could be added. +# + + + +org=`awk '/^domain/ {print $2}' < /etc/resolv.conf` +domain=`echo $org | sed -e 's/^[^.]*\.//'` +host=`hostname`".$org" + +echo "Domain: $domain" +echo "Organization: $org" +echo "Hostname: $host" + +sed -n -e '/message-id/s/^.*/"' {campus[mailer]++; campus[max]++} + '"/$org>/"' {u[mailer]++; u[max]++} + '"/$host>/"' {milton[mailer]++; milton[max]++} + {total[mailer]++; total[max]++} + {if(mailer == 0) printf("-->%s\n",$0)} + END { + for(m = 0; m <= max; m++) { + printf("%-10.10s", mailers[m]); + printf(" %11d %11d %11d %11d %11d (%3d%%)\n", milton[m], u[m] - milton[m], campus[m] -u[m], total[m] - campus[m], total[m], (total[m]*100)/total[max]); + } + printf(" ---- (%3d%%) (%3d%%) (%3d%%) (%3d%%)\n", (milton[max]*100)/total[max], ((u[max] - milton[max])*100)/total[max], ((campus[max] - u[max])*100)/total[max], ((total[max] - campus[max])*100)/total[max], (u[max]*100)/total[max]); + + }' > /tmp/syslogx.$$ + + +echo $host $org $domain | \ + awk '{printf(" %.17s %.11s %.11s Off Campus Total\n", $1, $2, $3)}' +egrep -v 'TOTAL|----|^-->' /tmp/syslogx.$$ | sort +0.60rn +egrep 'TOTAL|----' /tmp/syslogx.$$ +grep '^-->' /tmp/syslogx.$$ | sed -e 's/-->//' > other-traffic +rm -f /tmp/syslogx.$$ + + -- cgit v1.2.3-54-g00ecf