summaryrefslogtreecommitdiff
path: root/localshowmaildelivered
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2007-08-17 09:27:36 +0000
committerJonas Smedegaard <dr@jones.dk>2007-08-17 09:27:36 +0000
commit39c3477585ee00f234732b291318c4a3b22ea835 (patch)
tree00d8c5323e4d391b42f24585ba092ba75322ee2e /localshowmaildelivered
parent13aa25dd1963b140307f5950d12513e6daf5e4f7 (diff)
Improved logname resolving. Fix hardcoded hostname.
Diffstat (limited to 'localshowmaildelivered')
-rwxr-xr-xlocalshowmaildelivered11
1 files changed, 9 insertions, 2 deletions
diff --git a/localshowmaildelivered b/localshowmaildelivered
index 29d72a4..ceb90ec 100755
--- a/localshowmaildelivered
+++ b/localshowmaildelivered
@@ -3,11 +3,18 @@
# /usr/local/sbin/localshowmaildelivered
# Copyright 2007 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: localshowmaildelivered,v 1.1 2007-08-02 03:28:07 jonas Exp $
+# $Id: localshowmaildelivered,v 1.2 2007-08-17 09:27:36 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 INBOX$' | sed 's/jawa deliver(awi): msgid=//;s/: saved mail to INBOX//'
+#(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 \
+ | egrep -- 'deliver\(('"$1"')\).*saved mail to ' \
+ | sed 's/^\(.\{15\}\) [^)]*): msgid=/\1 (/;s/: saved mail to/)/;s/ INBOX$//'