Bug#307768: script to determine what system users may already have
received mail
Christoph Schindler
hop at 30hopsmax.at
Fri Jan 6 22:49:10 UTC 2006
I whipped up this small&dirty script to check which of the users in
/etc/passwd are not caught by /etc/aliases and which of them have
already gotten mail (via mail_spool or maildir_home).
Maybe it saves somebody a few minutes...
bye!hop
----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
#!/bin/bash
SYSUSERS=$(awk -F : '$3<1000 || $3>2999 { print $1 }' /etc/passwd)
echo "Mail for these users is not caught by /etc/aliases:"
for foo in $SYSUSERS
do
grep -Lq "^$foo" /etc/aliases || echo $foo
done
echo -e "\nThese system users may have already received Mail:"
for foo in $SYSUSERS
do
MAILDIR=$(awk -F: -v foo=$foo '$1 == foo { print $6 "/Maildir" }' /etc/passwd)
[ -a /var/mail/$foo ] && echo -e "$foo\tto /var/mail/$foo"
[ -a $MAILDIR ] && echo -e "$foo\tto $MAILDIR"
done
----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
More information about the Pkg-exim4-maintainers
mailing list