summaryrefslogtreecommitdiff
path: root/localshowmailreceived
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2007-09-27 21:32:22 +0000
committerJonas Smedegaard <dr@jones.dk>2007-09-27 21:32:22 +0000
commit190df74d4481e42879e28db390baeb82f1ef052f (patch)
tree2370a1af3fc1de16a3c001979785e9bedf232ad9 /localshowmailreceived
parent807c2c3e4f733b43b6b9cd21f085690e6efe514c (diff)
Use /etc/mailname (not hardcoded homebase.dk).
Diffstat (limited to 'localshowmailreceived')
-rwxr-xr-xlocalshowmailreceived5
1 files changed, 3 insertions, 2 deletions
diff --git a/localshowmailreceived b/localshowmailreceived
index 3d8fe19..b1a6511 100755
--- a/localshowmailreceived
+++ b/localshowmailreceived
@@ -3,7 +3,7 @@
# /usr/local/sbin/localshowmailreceived
# Copyright 2007 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: localshowmailreceived,v 1.1 2007-09-15 02:06:16 jonas Exp $
+# $Id: localshowmailreceived,v 1.2 2007-09-27 21:32:22 jonas Exp $
#
# List recently received emails
#
@@ -11,7 +11,8 @@
#
logfiles=1
+maildomain=$(if [ -r /etc/mailname ]; then head -n 1 /etc/mailname; fi;)
find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \
- | egrep -- ' -> <'"$1"'@homebase.dk>' \
+ | egrep -- ' -> <'"$1"'@'"$maildomain" \
| sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/'