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