blob: ab84bb8140148f49748d0aa623621b44b3b7b87e (
plain)
- #!/bin/sh
- #
- # /usr/local/sbin/localshowmailreceivedfromdomain
- # Copyright 2007 Jonas Smedegaard <dr@jones.dk>
- #
- # $Id: localshowmailreceivedfromdomain,v 1.3 2007-09-27 21:43:37 jonas Exp $
- #
- # List emails recently received from a certain domain
- #
- # TODO: Handle other indicatiors than AMaViS
- #
- logfiles="${logfiles:-1}"
- find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \
- | egrep -- '@'"$1"'> -> ' \
- | sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/'
|