Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Apr 2003 09:13:15 -0500
From:      Mike Meyer <mwm-dated-1050675195.c62900@mired.org>
To:        "Aslak Evang" <nyogtha@flipp.net>
Cc:        questions@freebsd.org
Subject:   Re: mail to all users on a system (from root)
Message-ID:  <16025.28795.74136.739119@guru.mired.org>
In-Reply-To: <007a01c301b8$c329c290$3800000a@LAPDANCE>
References:  <007a01c301b8$c329c290$3800000a@LAPDANCE>

next in thread | previous in thread | raw e-mail | index | archive | help
In <007a01c301b8$c329c290$3800000a@LAPDANCE>, Aslak Evang <nyogtha@flipp.net> typed:
> I've searched for ways for root to email all users on a system. The only
> easy solution I found included making a shellscript and setting it as an
> alias for "everybody". Problem was that in the script you had to insert
> all your users manually.
> Does anybody know of other methods for sending announcements to all
> users on a system? Could have done it with MOTD but few of them actually
> log-in. Most just read mail.
> 
> suggestions?

Two methods:

If all users have home directories in /home - or similar:
# cd /home
# mail *

Alternatively, you can send mail to everyone with something like this:

# mail $(awk -F: '$3 > 1000 { print $1 }' /etc/passwd)

I notice that zsh does autocompletion against /etc/passwd for the mail
command. Unfortunately, it still globs against files. Oh well.

	<mike
-- 
Mike Meyer <mwm@mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16025.28795.74136.739119>