summaryrefslogtreecommitdiff
path: root/localshowmailreceivedfromdomain
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-02-03 22:09:07 +0000
committerJonas Smedegaard <dr@jones.dk>2008-02-03 22:09:07 +0000
commit31a2f897cfd72618879f348b9c6c63b6f317d2c5 (patch)
tree7af6d11513adb3907b1af052adce88268469ad24 /localshowmailreceivedfromdomain
parent21f80eb17189a95f90f02af1cca52acb5bc31df5 (diff)
Rewrite to use common localshowlogentries.
Diffstat (limited to 'localshowmailreceivedfromdomain')
-rwxr-xr-xlocalshowmailreceivedfromdomain18
1 files changed, 11 insertions, 7 deletions
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 <dr@jones.dk>
+# Copyright 2007-2008 Jonas Smedegaard <dr@jones.dk>
#
-# $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