From 807c2c3e4f733b43b6b9cd21f085690e6efe514c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 15 Sep 2007 02:06:16 +0000 Subject: Fix bashism by using find + sort. Speedup scanning by using mail.log and only the single most recent file by default (overridable with logfiles=). --- localshowmaildelivered | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'localshowmaildelivered') 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 # -# $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 \ -- cgit v1.2.3