How do I send a email to all users on server?
fedora-list at epperson.homelinux.net
fedora-list at epperson.homelinux.net
Mon Feb 19 19:32:35 UTC 2007
On Mon, February 19, 2007 13:56, Bazooka Joe wrote:
> I want to notify my users of downtime... I have not been able to find
> any way to send an email to all users on server.
>
> any idea how that is done?
Lotsa ways to do it. You could create an alias with all the names, for
instance, and mail to that. If they're in /etc/passwd, then
cat /etc/passwd|cut -d: -f1|while
read user
do
mail -s "Downtime Scheduled" $user < message.txt
done
would do it (put your message in message.txt). You'd also send mail to
the non-user users like daemon, but you'd cover everybody. If you're
using NIS, then "ypcat passwd" instead of "cat /etc/passwd".
More information about the fedora-list
mailing list