summaryrefslogtreecommitdiff
path: root/localshowmaildelivered
blob: 6e683eb62f5d9fb038b2ff8de99a182507245a72 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localshowmaildelivered
  4. # Copyright 2007 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localshowmaildelivered,v 1.3 2007-09-15 02:06:16 jonas Exp $
  7. #
  8. # List recently delivered emails
  9. #
  10. # TODO: Handle other delivery methods than dovecot
  11. #
  12. logfiles=1
  13. find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \
  14. | egrep -- 'deliver\(('"$1"')\).*saved mail to ' \
  15. | sed 's/^\(.\{15\}\) [^)]*): msgid=/\1 (/;s/: saved mail to/)/;s/ INBOX$//'