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<-----



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to