From 31a2f897cfd72618879f348b9c6c63b6f317d2c5 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 3 Feb 2008 22:09:07 +0000 Subject: Rewrite to use common localshowlogentries. --- localshowmailreceivedfromdomain | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'localshowmailreceivedfromdomain') diff --git a/localshowmailreceivedfromdomain b/localshowmailreceivedfromdomain index ab84bb8..dfe986f 100755 --- a/localshowmailreceivedfromdomain +++ b/localshowmailreceivedfromdomain @@ -1,17 +1,21 @@ #!/bin/sh # # /usr/local/sbin/localshowmailreceivedfromdomain -# Copyright 2007 Jonas Smedegaard +# Copyright 2007-2008 Jonas Smedegaard # -# $Id: localshowmailreceivedfromdomain,v 1.3 2007-09-27 21:43:37 jonas Exp $ +# $Id: localshowmailreceivedfromdomain,v 1.4 2008-02-03 22:09:07 jonas Exp $ # # List emails recently received from a certain domain # -# TODO: Handle other indicatiors than AMaViS +# TODO: Handle other patterns than AMaViS # -logfiles="${logfiles:-1}" +set -e -find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \ - | egrep -- '@'"$1"'> -> ' \ - | sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/' +localshowlogentries "$1" \ + '@' \ + '> -> ' \ + 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/' \ + 's/^.*Message-ID: //;s/: .*$//' + +exit 0 -- cgit v1.2.3