summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2007-09-15 02:06:16 +0000
committerJonas Smedegaard <dr@jones.dk>2007-09-15 02:06:16 +0000
commit807c2c3e4f733b43b6b9cd21f085690e6efe514c (patch)
tree273fac2a6978c35a9b44929c2932db3d9d5f75b9
parentd1badbce054b5510145c56e7e014db50edc12320 (diff)
Fix bashism by using find + sort. Speedup scanning by using mail.log and only the single most recent file by default (overridable with logfiles=).
-rwxr-xr-xlocalshowmaildelivered5
-rwxr-xr-xlocalshowmailreceived17
-rwxr-xr-xlocalshowmailreceivedfromdomain8
3 files changed, 24 insertions, 6 deletions
diff --git a/localshowmaildelivered b/localshowmaildelivered
index ceb90ec..6e683eb 100755
--- a/localshowmaildelivered
+++ b/localshowmaildelivered
@@ -3,16 +3,13 @@
# /usr/local/sbin/localshowmaildelivered
# Copyright 2007 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: localshowmaildelivered,v 1.2 2007-08-17 09:27:36 jonas Exp $
+# $Id: localshowmaildelivered,v 1.3 2007-09-15 02:06:16 jonas Exp $
#
# List recently delivered emails
#
# TODO: Handle other delivery methods than dovecot
#
-#(zcat /var/log/syslog.{7,6,5,4,3,2,1}.gz; cat /var/log/syslog) | egrep -- 'deliver\(('"$1"')\).*saved mail to ' | sed 's/^\(.\{15\}\) [^)]*): msgid=/\1 (/;s/: saved mail to/)/;s/ INBOX$//'
-#(zcat /var/log/mail.log.{7,6,5,4,3,2,1}.gz; cat /var/log/mail.log) | egrep -- 'deliver\(('"$1"')\).*saved mail to ' | sed 's/^\(.\{15\}\) [^)]*): msgid=/\1 (/;s/: saved mail to/)/;s/ INBOX$//'
-
logfiles=1
find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \
diff --git a/localshowmailreceived b/localshowmailreceived
new file mode 100755
index 0000000..3d8fe19
--- /dev/null
+++ b/localshowmailreceived
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# /usr/local/sbin/localshowmailreceived
+# Copyright 2007 Jonas Smedegaard <dr@jones.dk>
+#
+# $Id: localshowmailreceived,v 1.1 2007-09-15 02:06:16 jonas Exp $
+#
+# List recently received emails
+#
+# TODO: Handle other indicatiors than AMaViS
+#
+
+logfiles=1
+
+find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \
+ | egrep -- ' -> <'"$1"'@homebase.dk>' \
+ | sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/'
diff --git a/localshowmailreceivedfromdomain b/localshowmailreceivedfromdomain
index a671408..d83f394 100755
--- a/localshowmailreceivedfromdomain
+++ b/localshowmailreceivedfromdomain
@@ -3,11 +3,15 @@
# /usr/local/sbin/localshowmailreceivedfromdomain
# Copyright 2007 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: localshowmailreceivedfromdomain,v 1.1 2007-09-15 01:53:15 jonas Exp $
+# $Id: localshowmailreceivedfromdomain,v 1.2 2007-09-15 02:06:16 jonas Exp $
#
# List emails recently received from a certain domain
#
# TODO: Handle other indicatiors than AMaViS
#
-(zcat /var/log/syslog.{7,6,5,4,3,2,1}.gz; cat /var/log/syslog) | egrep -- '@'"$1"'> -> ' | sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/'
+logfiles=1
+
+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/'