summaryrefslogtreecommitdiff
path: root/localshowmaildelivered
blob: 4d3bc5a9dbe8b09d2c69a2e5735392344b343f43 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localshowmaildelivered
  4. # Copyright 2007 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localshowmaildelivered,v 1.4 2007-09-27 21:43:37 jonas Exp $
  7. #
  8. # List recently delivered emails
  9. #
  10. # TODO: Handle other delivery methods than dovecot
  11. #
  12. logfiles="${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$//'